Filename encodings and GLib



Owen Taylor writes:
 > On, Windows, the situation is more problematical. As I understand it:
 >  - Every filename (and directory name) has a short 8.3 form, ASCII only

Except if the 8.3 name would be identical to the "real" name, then the
8.3 name isn't present.

Also, I think whether short names are generated or not can be settable
per file system. But presumably it usually is turned on.

 >    the correspondence between this name and the long name can only
 >    be determined by accessing the filesystem.

True, as the 8.3 name is stored in the file system, and generated when
files are created or renamed. Different file system or CIFS server
implementations (like Windows itself, NetApp, Samba, etc) use
different algorithms to generate 8.3 names.

 >  - C library functions (fopen, etc) and the non-W forms of the windows
 >    API functions either take:
 >    - Filenames in the current codepage
 >    - The short 8.3 form of the filenames

In addition, there are wide character versions of the C library
functions (wopen, wfopen, wpopen, wremove, wtmpnam, any more?) that
take the wchar_t (UTF-16LE) names.

 > So, what do we use for the system representation on Windows:

 >  3) The short-form for non-ASCII filenames, otherwise the ASCII
 >     only name.

I would change this alternative a bit, to:
    3) The short form for filenames not representable in the current
       codepage, otherwise the current codepage form.

I think it is fairly uncommon in real life for a machine to have
filenames that can't be represented in the current codepage, or for a
user to want to create a file with a name not representable in her
current codepage. But of course, there will always be some groups of
people who do see such cases regularily, and considering GTK's and
Pango's i18n features, it might well be that these groups are more
likely than other to use some GTK application.

Still, you are right that 1) is the only workable alternative. I am
grateful that Owen &co once again are willing to add stuff to cater
for people stuck on Windows...

--tml





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]