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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham 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!news2.volia.net!news.germany.com!solnet.ch!solnet.ch!news-zh.switch.ch!switch.ch!news.hispeed.ch!linux2.krischik.com!news From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: Filenames in Ada Date: Thu, 24 Nov 2005 20:05:37 +0100 Organization: Cablecom Newsserver Message-ID: <2135054.7OILsdcKq7@linux1.krischik.com> References: <1653090.31FM62oI6I@linux1.krischik.com> NNTP-Posting-Host: 84-73-3-231.dclient.hispeed.ch Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.hispeed.ch 1132861532 3169 84.73.3.231 (24 Nov 2005 19:45:32 GMT) X-Complaints-To: news@hispeed.ch NNTP-Posting-Date: Thu, 24 Nov 2005 19:45:32 +0000 (UTC) User-Agent: KNode/0.9.2 Xref: g2news1.google.com comp.lang.ada:6595 Date: 2005-11-24T20:05:37+01:00 List-Id: Randy Brukardt wrote: > "Martin Krischik" wrote in message > news:1653090.31FM62oI6I@linux1.krischik.com... > ... >> How does one deal with modern (utf-8) filenames in Ada? > > We talked about this briefly at a recent meeting. We decided it was too > late to design a proper solution, and virtually all operating systems have > a way to deal with this anyway. (That is that they take UTF-8 names). > There's no conceptual problem with putting UTF-8 into a value of type > String, and as someone else showed, that's typcially supported by Ada > implementations. Only Windows wants UTF-16 and extra APIs instead . And that is indeed the problem I have. Just a question. I get an NAME_ERROR exception in Ada.Directories.More_Entries. Is that actually correct? Should the exception not be in Ada.Directories.Simple_Name? Only when I convert the name to a string it becomes relevant that it can't be represented into Latin 1. See source in http://cvs.sourceforge.net/viewcvs.py/wikibook-ada/demos/Source/make_m3u.adb?only_with_tag=HEAD&view=markup > A bigger problem is that Ada (any flavor) has no built-in support for > UTF-8. I think this is a mistake, but I didn't find much support for > adding any packages. Well, that can be rectified with external packages. Text_IO is not as easy to replace > It's insane to use Wide_Wide_String to store any > significant amount of text, as it would waste nearly 3/4s of the space in > typical use, so you'd have to use something else (like UTF-8) for storage > anyway. Tell the C99 designers. They though that wchar_t should be large enough to hold all possible values - without defining what "all possible values" actually is. As it is GNU C defines it as 32 bit. > Since filenames are implementation-defined anyway, there isn't a whole lot > of value to standardizing how they're written. So, it's just up to your > implementer to do something appropriate. As long as you don't "push them with the nose on it" as we say in Germany: "An implementation may support Wide_String or Wide_Wide_String variants for passing filenames if supported by the platform" they won't do nothing. Martin -- mailto://krischik@users.sourceforge.net Ada programming at: http://ada.krischik.com