From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "J-P. Rosen" Newsgroups: comp.lang.ada Subject: Re: Bug in Ada - Latin 1 is not a subset of UTF-8 Date: Tue, 18 Oct 2016 07:44:07 +0200 Organization: A noiseless patient Spider Message-ID: References: <86f0d2fe-d498-4bc4-bb9d-e34629c89bb4@googlegroups.com> <87funuae2q.fsf@adaheads.sparre-andersen.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Injection-Date: Tue, 18 Oct 2016 05:43:55 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="b144f04b13109f3183a7aba0a811ee75"; logging-data="22760"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX198Ob11C+EMSJOz7ahrGKug" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 In-Reply-To: <87funuae2q.fsf@adaheads.sparre-andersen.dk> Cancel-Lock: sha1:4TsnRWcErsWoCXlO9IuLdVWpvAU= Xref: news.eternal-september.org comp.lang.ada:32102 Date: 2016-10-18T07:44:07+02:00 List-Id: Le 17/10/2016 à 22:57, Jacob Sparre Andersen a écrit : >> UTF_String should be implemented as an array like String and then >> > UTF_8_String should be a subtype of UTF_String or a renaming, if that >> > is the intent. > I think the best you can do is to ignore the subtypes declared in > Ada.Strings.UTF_Encoding (as they are just plain wrong), and declare > your own type for storing UTF-8 encoded strings. FWIW, the issue of whether to make UTF-8 a different type or a subtype of String was discussed at the ARG. It was decided to make a subtype basically on the grounds that: 1) In most cases, you need to read the beginning of a file (presumably with Text_IO) before you decide whether it is UTF-8 or not 2) We feared that with a separate type, people would complain that "once again, Ada does it differently than other languages", and that it would involve many type conversions for no real benefit. -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00 http://www.adalog.fr