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 X-Google-Thread: 103376,bde6706c124e6eed X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.glorb.com!news.germany.com!news.tu-darmstadt.de!tsicnews.teliasonera.com!newspeer3.de.telia.net!de.telia.net!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Filenames in Ada Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1653090.31FM62oI6I@linux1.krischik.com> <24636991.vKdJMLXJE2@linux1.krischik.com> Date: Thu, 24 Nov 2005 21:49:43 +0100 Message-ID: NNTP-Posting-Date: 24 Nov 2005 21:49:35 MET NNTP-Posting-Host: e28c01ac.newsread4.arcor-online.net X-Trace: DXC=b2DT_dgJ@ZcgZnGD9BX_me:ejgIfPPlddjW\KbG]kaMhFYk:AnJB[Cm118jo\61Qnh[6LHn;2LCVn[ On Thu, 24 Nov 2005 20:13:01 +0100, Martin Krischik wrote: > Dmitry A. Kazakov wrote: > >> On Wed, 23 Nov 2005 18:36:47 +0100, Martin Krischik wrote: >> > Find the code at: > http://cvs.sourceforge.net/viewcvs.py/wikibook-ada/demos/Source/make_m3u.adb?only_with_tag=HEAD&view=markup > > at let it loose at a directory with Cyrillic filenames. It works perfectly well. Ada.Directories returns file names as-is. One don't need to change anything: while More_Entries (Search_Artist) loop Get_Next_Entry (Search_Artist, Artist_Entry); declare Artist : String renames Simple_Name (Artist_Entry); -- This is UTF-8 encoded under Linux begin if ( Artist /= "." -- ASCII-7 is UTF-8! and then Artist /= ".." and then Artist /= "Folder Settings" ) then Put_Line (Artist); -- Outputs UTF-8 end if; end; end loop; >> Though it cannot work under Windows, because GNAT run-time translates >> Create into some CreateFileA Windows API. Moreover Windows is UTF-16. So >> there is no chance for Ada.Text_IO.Create. I presume one could directly >> use CreateFileW from Windows API with a Wide_String file name, but that's >> another story. > > I fear that is the only option available. But how to turn the Windows > filehandle into a Ada one... I'm afraid there is no other way than to ask ACT 1) to use xxxW stuff for all file operations and 2) to translate String file names from UTF-8 to UTF-16 when it goes down to Windows and from UTF-16 to UTF-8 when it goes back. >> I don't see any great problem here. I would add UTF-8 variants for all >> calls where a file name is mentioned. We could even switch from Latin-1 to >> UTF-8. This seems to be independent on Text_IO vs. Wide_Text_IO issue. > > I am not sure. There are quite a few OS dependent functions involved here. It cannot be portable. Well, does VMS still use Radix-50 for file names? (:-)) That's wise! -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de