comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: I need to show extended Ascii codes in GtkAda environment
Date: Fri, 22 Nov 2019 15:12:10 +0100
Date: 2019-11-22T15:12:10+01:00	[thread overview]
Message-ID: <qr8qbp$15gp$1@gioia.aioe.org> (raw)
In-Reply-To: 5dd7de1b$0$1694$e4fe514c@news.kpn.nl

On 2019-11-22 14:09, L Dries wrote:
> In a GtkAda environment I have the need to present some characters or 
> strings with characters in the Extended character Ascii range for 
> instance O with slash (216). I create a constant character with
> 
> Slash_null   : constant string(1 .. 1) := "" & character'Val(216);

GTK is UTF-8. You must encode and decode anything that is not ASCII 
7-bit. [A pragmatic approach is to ignore the reference manual and treat 
all strings UTF-8 rather than mandated Latin 1.]

Anyway, assuming you need the LATIN CAPITAL LETTER O WITH STROKE 
character (code point 216), encoded in UTF-8 it is C3 98. Note, two 
octets. Thus:

    Slash_Null : constant String :=
                    Character'Val (16#C3#) & Character'Val (16#98#);

With Strings Edit for Ada you could also write:

    Slash_Null : constant String := Strings_Edit.UTF8.Image (216);

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


  reply	other threads:[~2019-11-22 14:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-22 13:09 I need to show extended Ascii codes in GtkAda environment L Dries
2019-11-22 14:12 ` Dmitry A. Kazakov [this message]
2019-11-22 21:22   ` Randy Brukardt
2019-11-22 21:36     ` Dmitry A. Kazakov
replies disabled

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