comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: strange behaviour of utf-8 files
Date: Sat, 16 Nov 2013 18:01:07 +0100
Date: 2013-11-16T18:01:07+01:00	[thread overview]
Message-ID: <5287a4d3$0$9523$9b4e6d93@newsspool1.arcor-online.net> (raw)
In-Reply-To: <9d00683c-949c-4e88-a161-ebd78b350d39@googlegroups.com>

On 16.11.13 16:09, Stoik wrote:

> Thanks for the answer. Your advice is certainly sound, but not very satisfactory. The whole purpose of utf-8 is to make
> things portable across platforms. If the compiler cannot deal properly with the
> source code written in the utf-8 encoding, then the whole effort that went into
> all the wide_ and wide_wide_ packages and the new packages that deal with various encodings is lost (all the Latin-x possibilities are useless anyway, at least on Windows platform). I am adjoining a trivial program which works differently according to the encoding (UTF-8 or ISO-8859-1) of the source code, printing 1 or 2 as the answer.
>
> with ada.text_io; use ada.text_io;
> procedure example is
>     S : String := "ó";
> begin
>     Put_Line (S'Length'Img);
> end;

GNAT has two switches that affect its way of looking at
coded characters in source text:

for identifiers in source text, specify -gnatiC
  where C is one of the characters listed 3.2.10
  of the GNAT UG accompanying the compiler;

for the wide character encoding method, specify -gnatWE
  where E is one of the characters listed in the
  same document.

With switch -gnatW8, I get

$ ./example
  1
$

That is, the source text is understood to be encoded
in UTF-8, and 'ó' becomes Character'Val (243), viz. LC_O_Acute.

  parent reply	other threads:[~2013-11-16 17:01 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-16 13:12 strange behaviour of utf-8 files Stoik
2013-11-16 13:34 ` Dmitry A. Kazakov
2013-11-16 15:09   ` Stoik
2013-11-16 15:55     ` Dmitry A. Kazakov
2013-11-17 13:32       ` Georg Bauhaus
2013-11-17 14:07         ` Dmitry A. Kazakov
2013-11-17 17:19           ` Dennis Lee Bieber
2013-11-17 18:07             ` Dmitry A. Kazakov
2013-11-17 19:05           ` Georg Bauhaus
2013-11-17 20:38             ` Dmitry A. Kazakov
2013-11-18  8:38               ` Georg Bauhaus
2013-11-18  9:01                 ` Dmitry A. Kazakov
2013-11-18 10:06                   ` Georg Bauhaus
2013-11-18  8:44               ` Georg Bauhaus
2013-11-18 10:24                 ` Dmitry A. Kazakov
2013-11-18 13:05                   ` G.B.
2013-11-18 15:25                     ` Dmitry A. Kazakov
2013-11-18 15:51                       ` G.B.
2013-11-18 17:34                         ` Dmitry A. Kazakov
2013-11-18  0:34           ` Stoik
2013-11-16 17:01     ` Georg Bauhaus [this message]
2013-11-17 10:38       ` Stoik
2013-11-16 15:12   ` Stoik
2013-11-16 15:57     ` Dmitry A. Kazakov
2013-11-17 11:12       ` Stoik
2013-11-22  1:03         ` Randy Brukardt
2013-11-22  3:02           ` Shark8
2013-11-22 11:54             ` Georg Bauhaus
2013-11-23  4:14             ` Randy Brukardt
2013-12-06  2:17               ` Georg Bauhaus
2013-11-16 20:06     ` Peter C. Chapin
2013-11-17 10:34       ` Stoik
2013-11-22  0:53       ` Randy Brukardt
replies disabled

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