From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!news.gegeweb.eu!gegeweb.org!news.muarf.org!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!212.27.60.64.MISMATCH!cleanfeed3-b.proxad.net!nnrp1-1.free.fr!not-for-mail Newsgroups: comp.lang.ada References: <607b5b20$0$27442$426a74cc@news.free.fr> <86mttuk5f0.fsf@stephe-leake.org> From: DrPi <314@drpi.fr> Subject: Re: Ada and Unicode Date: Mon, 19 Apr 2021 18:14:37 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: <86mttuk5f0.fsf@stephe-leake.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Message-ID: <607dac71$0$3681$426a74cc@news.free.fr> Organization: Guest of ProXad - France NNTP-Posting-Date: 19 Apr 2021 18:14:41 CEST NNTP-Posting-Host: 82.65.30.55 X-Trace: 1618848881 news-1.free.fr 3681 82.65.30.55:59993 X-Complaints-To: abuse@proxad.net Xref: reader02.eternal-september.org comp.lang.ada:61852 List-Id: Le 19/04/2021 à 11:08, Stephen Leake a écrit : > DrPi <314@drpi.fr> writes: > >> Any way to use source code encoded in UTF-8 ? > > for Switches ("non_ascii.ads") use ("-gnatiw", "-gnatW8"); > That's interesting. Using these switches at project level is not OK. Project source files not always use the same encoding. Especially when using libraries. Using these switches at source level is better. A little bit complicated to use but better. > from the gnat user guide, 4.3.1 Alphabetical List of All Switches: > > `-gnati`c'' > Identifier character set (`c' = 1/2/3/4/8/9/p/f/n/w). For details > of the possible selections for `c', see *note Character Set > Control: 4e. > > This applies to identifiers in the source code > > `-gnatW`e'' > Wide character encoding method (`e'=n/h/u/s/e/8). > > This applies to string and character literals. > >> What's the way to manage Unicode correctly ? > > There are two issues: Unicode in source code, that the compiler must > understand, and Unicode in strings, that your program must understand. > > (I've never written a program that dealt with utf strings other than > file names). > > -gnati8 tells the compiler that the source code uses utf-8 encoding. > > -gnatW8 tells the compiler that string literals use utf-8 encoding. > > package Ada.Strings.UTF_Encoding provides some facilities for dealing > with utf. It does _not_ provide walking a string by code point, which > would seem necessary. > > We could be more helpful if you show what you are trying to do, you've > tried, and what errors you got. >