comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: GtkAda and €
Date: Sat, 11 Sep 2021 16:13:07 +0200	[thread overview]
Message-ID: <shidhk$ak$1@gioia.aioe.org> (raw)
In-Reply-To: e8b60ad9-b68f-4520-8f1d-1c8edfa03662n@googlegroups.com

On 2021-09-11 15:51, AdaMagica wrote:
> Being German, I need umlauts and € together in strings to write them to some labels.
> Using Character'Val (16#E2#) & Character'Val (16#82#) & Character'Val (16#AC#)
> complicates things, since umlauts are above 255 and need transformation to UTF8,
> whereas the euro sequence above is already in UTF8 and must not again be transformed.
> 
> What a mess!

Huh, the mess here is Latin-1 introduced by Ada 95, no such thing should 
have been even supported. This happened because in 90s UTF-8 was not yet 
established, so Ada 95 made Character Latin-1 and added Wide_Character 
for UCS-2. This was a huge mistake with wide (pun intended) reaching 
nasty consequences.

Since Ada type system is too weak to handle encodings, Strings should 
simply be UTF-8 and Character an octet with lower 7-bits corresponding 
to ASCII.

Anyway, for anything that is not ASCII I use a named constant.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2021-09-11 14:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-10 17:56 GtkAda and € AdaMagica
2021-09-10 18:53 ` Dmitry A. Kazakov
2021-09-11  9:20   ` AdaMagica
2021-09-11  9:57     ` AdaMagica
2021-09-11 10:04     ` Dmitry A. Kazakov
2021-09-11 11:11       ` Emmanuel Briot
2021-09-11 12:47         ` Dmitry A. Kazakov
2021-09-11 13:26       ` AdaMagica
2021-09-11 13:51         ` AdaMagica
2021-09-11 14:13           ` Dmitry A. Kazakov [this message]
2021-09-11 17:46           ` Manuel Gomez
2021-09-12  7:04             ` AdaMagica
2021-09-12 11:44               ` Manuel Gomez
2021-09-13  7:21           ` Vadim Godunko
replies disabled

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