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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: border1.nntp.dca3.giganews.com!backlog3.nntp.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: strange behaviour of utf-8 files Date: Sat, 16 Nov 2013 16:55:08 +0100 Organization: cbb software GmbH Message-ID: <1w23uq33ul2i8$.wzjpp3evot36.dlg@40tude.net> References: <73e0853b-454a-467f-9dc7-84ca5b9c29b2@googlegroups.com> <1ghx537y5gbfq.17oazom68d4n6.dlg@40tude.net> <9d00683c-949c-4e88-a161-ebd78b350d39@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: Ws8cDh6KC0dYMbHlsA0RIw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 X-Original-Bytes: 2124 Xref: number.nntp.dca.giganews.com comp.lang.ada:183899 Date: 2013-11-16T16:55:08+01:00 List-Id: On Sat, 16 Nov 2013 07:09:48 -0800 (PST), Stoik wrote: > If the compiler cannot deal properly with the source code > written in the utf-8 encoding, The compiler can. I believe there are GCC switches which together with locale control that. > 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). Not at all. Ada's String directly corresponds to the A-functions of Windows API. Windows W-functions are UTF-16. And the issue has nothing to do with the language. It is about using one encoding in the editor and another with the compiler. > with ada.text_io; use ada.text_io; > procedure example is > S : String := "ó"; > begin > Put_Line (S'Length'Img); > end; As I said in order to avoid troubles, don't use anything but ASCII. Do this: SMALL_LETTER_O_WITH_ACUTE_UTF8 : constant String := Character'Val (16#C3#) & Character'Val (16#B3#); SMALL_LETTER_O_WITH_ACUTE_Latin1 : constant String := (1 => Character'Val (16#F3#)); -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de