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!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: unicode and wide_text_io Date: Thu, 28 Dec 2017 15:25:51 +0100 Organization: Aioe.org NNTP Server Message-ID: References: <892d5b9a-6460-419a-a09d-d00a4b84c668@googlegroups.com> NNTP-Posting-Host: TliDXSPe+gBSGCqP3SEJ2Q.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.8.2 Xref: reader02.eternal-september.org comp.lang.ada:49676 Date: 2017-12-28T15:25:51+01:00 List-Id: On 2017-12-28 14:15, Mehdi Saada wrote: > Ok, I'm done with it. It sure is interesting, but I don't want to > even think about all this stuff for the time being... Talk about > "universal standard", when it's (apparently) it's far from universal or uniform ! It is. Everybody uses UTF-8. Even under Windows. The text is converted from/to UTF-16 right after or before passing it to the system call. All processing is UTF-8. E.g. GTK uses UTF-8 consistently no matter what OS. >> Easy: it uses a variable-width representation. > Under the assumption terminals will be able to display it... well, > whatever I use in the end, I've got to suppose it anyway. Sure they are Linux and Windows. Take this program: ------------------------------------ with Ada.Text_IO; use Ada.Text_IO; procedure Superscript is begin Put_Line ( "Superscript 1=" & Character'Val (194) & Character'Val (185) ); end Superscript; ------------------------------------ Start Windows console: > gnatmake superscript.adb > chcp 65001 > superscript This will, depending on the font, nicely output: Superscript 1=ยน P.S. Batch command chcp selects the code page of the console. 65001 is for UTF-8. P.P.S. Some Windows fonts do not have sub-/superscript glyphs. So you might wish to set the console to Lucida or some other fixed space font with Unicode support. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de