comp.lang.ada
 help / color / mirror / Atom feed
* Ada.Directories and multibyte-filename
@ 2006-07-13 17:38 Y.Tomino
  2006-07-14 12:05 ` Björn Persson
  2006-07-14 16:37 ` Georg Bauhaus
  0 siblings, 2 replies; 4+ messages in thread
From: Y.Tomino @ 2006-07-13 17:38 UTC (permalink / raw)


Searching directory with Ada.Directories, it raises Name_Error for
normal multibyte-filename.

Test:
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Directories; use Ada.Directories;
procedure Test is
   Search : Search_Type;
   File : Directory_Entry_Type;
begin
   Start_Search(Search, ".", "*");
   while More_Entries(Search) loop
      Get_Next_Entry(Search, File);
      Ada.Text_IO.Put_Line(Simple_Name(File));
   end loop;
   End_Search(Search);
end Test;

Compile and run it on the directory containing file named with
multibyte-characters.

raised ADA.IO_EXCEPTIONS.NAME_ERROR : a-direct.adb:122

It is not possible to use Ada.Directories in the regions having
multibyte-characters...

-- 
YT



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Ada.Directories and multibyte-filename
  2006-07-13 17:38 Ada.Directories and multibyte-filename Y.Tomino
@ 2006-07-14 12:05 ` Björn Persson
  2006-08-10  8:39   ` demoonlit
  2006-07-14 16:37 ` Georg Bauhaus
  1 sibling, 1 reply; 4+ messages in thread
From: Björn Persson @ 2006-07-14 12:05 UTC (permalink / raw)


Y.Tomino wrote:
> It is not possible to use Ada.Directories in the regions having
> multibyte-characters...

You write that as if you think it's a flaw in how the proposed new Ada 
standard specifies Ada.Directories. It does indeed seem to assume that 
all possible file names can be encoded in Latin-1, as all the operations 
work with String only.

If instead you consider this a bug in Gnat (assuming your compiler is 
Gnat like in your other posts), then please report it in GCC Bugzilla 
(http://gcc.gnu.org/bugs.html). Don't forget to provide detailed 
information on version of Gnat, operating system, locale and all that.

-- 
Bj�rn Persson                              PGP key A88682FD
                    omb jor ers @sv ge.
                    r o.b n.p son eri nu



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Ada.Directories and multibyte-filename
  2006-07-13 17:38 Ada.Directories and multibyte-filename Y.Tomino
  2006-07-14 12:05 ` Björn Persson
@ 2006-07-14 16:37 ` Georg Bauhaus
  1 sibling, 0 replies; 4+ messages in thread
From: Georg Bauhaus @ 2006-07-14 16:37 UTC (permalink / raw)


Y.Tomino wrote:
> Searching directory with Ada.Directories, it raises Name_Error for
> normal multibyte-filename.
> 
> Test:
> with Ada.Text_IO; use Ada.Text_IO;
> with Ada.Directories; use Ada.Directories;
> procedure Test is

Using GNAT GPL 2005 on Ubuntu for translating this program,
it works just fine. (The directory has entries "Hällü.file" and "ぁ".)

Linux based OSs tend to use UTF-8 throughout, i.e. 8bit bytes.
This is probably the advantage here. (Perhaps many western programmers
think that a seven segment display is quite sufficent, because they
are used to it. ;-)

> 
> It is not possible to use Ada.Directories in the regions having
> multibyte-characters...
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Ada.Directories and multibyte-filename
  2006-07-14 12:05 ` Björn Persson
@ 2006-08-10  8:39   ` demoonlit
  0 siblings, 0 replies; 4+ messages in thread
From: demoonlit @ 2006-08-10  8:39 UTC (permalink / raw)


Björn Persson wrote:
> You write that as if you think it's a flaw in how the proposed new Ada
> standard specifies Ada.Directories. It does indeed seem to assume that
> all possible file names can be encoded in Latin-1, as all the operations
> work with String only.

I think that it's necessary to prepare the Wide-version in reality.
However, AdaCore seem they are thinking Ada's File API take Unicode
filename.
http://www.adacore.com/2006/04/08/NF-505-EC08-010-gnat/
I do not care this point if it works correctly.

> If instead you consider this a bug in Gnat (assuming your compiler is
> Gnat like in your other posts), then please report it in GCC Bugzilla
> (http://gcc.gnu.org/bugs.html). Don't forget to provide detailed
> information on version of Gnat, operating system, locale and all that.

But, these API implementation is not making sense of the meaning.
It is possible to think "Character" type based Unicode filename to
UTF-8.
Actually, it is locale-character-code(Shift_JIS in Japanease-ver.
Windows, LC_xxx environment-variable in Linux...when locale is UTF-8 by
chance, it is likely to operate according to the
intention.) that Ada.Text_IO.Create accepts.
Also, Ada.Directories.Validity takes correct-filename as error.
Confusion and mistake seem in each place.

Therefore, I consider this a bug in GNAT.
Thank you for teaching the report destination.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-08-10  8:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-13 17:38 Ada.Directories and multibyte-filename Y.Tomino
2006-07-14 12:05 ` Björn Persson
2006-08-10  8:39   ` demoonlit
2006-07-14 16:37 ` Georg Bauhaus

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