comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: unicode and wide_text_io
Date: Thu, 28 Dec 2017 15:25:51 +0100
Date: 2017-12-28T15:25:51+01:00	[thread overview]
Message-ID: <p22ute$cc4$1@gioia.aioe.org> (raw)
In-Reply-To: 892d5b9a-6460-419a-a09d-d00a4b84c668@googlegroups.com

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

  reply	other threads:[~2017-12-28 14:25 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-27 18:08 unicode and wide_text_io Mehdi Saada
2017-12-27 20:04 ` Dmitry A. Kazakov
2017-12-27 21:47   ` Dennis Lee Bieber
2017-12-27 22:32 ` Mehdi Saada
2017-12-27 22:33   ` Mehdi Saada
2017-12-27 22:48     ` Mehdi Saada
2017-12-27 23:32       ` Mehdi Saada
2017-12-27 23:57   ` Randy Brukardt
2017-12-28  5:20     ` Robert Eachus
2017-12-31 21:41       ` Keith Thompson
2017-12-28  9:04   ` Dmitry A. Kazakov
2017-12-28 11:06     ` Niklas Holsti
2017-12-28 11:50       ` Dmitry A. Kazakov
2017-12-28 13:15 ` Mehdi Saada
2017-12-28 14:25   ` Dmitry A. Kazakov [this message]
2017-12-28 14:32     ` Simon Wright
2017-12-28 15:28       ` Niklas Holsti
2017-12-28 15:47         ` 00120260b
2017-12-28 22:35           ` G.B.
2017-12-28 18:15         ` Simon Wright
2017-12-28 22:36 ` Mehdi Saada
2017-12-29  0:51   ` Randy Brukardt
2017-12-30 12:50   ` Björn Lundin
2017-12-30 15:33     ` Dennis Lee Bieber
2017-12-30 15:56       ` Dmitry A. Kazakov
2017-12-30 23:20       ` Björn Lundin
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox