bug-gnulib
[Top][All Lists]
Advanced

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

Re: file names encoding on Windows


From: Bruno Haible
Subject: Re: file names encoding on Windows
Date: Sat, 9 Jul 2011 11:59:13 +0200
User-agent: KMail/1.9.9

[re-adding CC bug-gnulib]

Eli Zaretskii wrote:
> > I suggest using the gnulib module localcharset which provides the
> > function locale_charset().
> 
> We are talking about the encoding of file names in the file system,
> right?

Yes.

> If so, is it necessarily the case that `locale_charset' will 
> produce the correct value for that?

Yes. locale_charset() returns the encoding that the user has set - some way
or the other - for his locale. If file names on the part of the disk that the
user accesses are not in this encoding, he would face serious mojibake.

> I'm not sure.  At least for Windows, `locale_charset' is not necessarily TRT.

What is the "right thing" for detecting the encoding of file names on Windows,
if not GetACP()?

There is a known bug in locale_charset: If a mingw program calls setlocale()
with a locale different from the system one, locale_charset() will ignore this
setlocale() call. But other than that, what is wrong?

> Would it make sense to let the user specify the local encoding, at
> least as an option?

No, because the encoding is not the only aspect of cultural conventions.
There's also the language, the sort order, and more. The user has the
possibility to set a locale in the Windows Control Panel. But it does not
allow to change the encoding. Why?
  1. Because the OS uses GetACP() in many places.
  2. Because the ISO C functions like strftime() etc. from MSVCRT wouldn't
     work in de_DE.UTF-8 or zh_CN.GB18030 (or similar) locales.

Bruno
-- 
In memoriam Báb <http://en.wikipedia.org/wiki/Báb>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]