Re: g_locale_to_utf8 on current MS Windows



I've had a problem report from a user of my GTK app on Windows 7,

You mean this is something new in Windows 7 (which I find hard to
believe), or has this particular user just not used your app on
earlier Windows versions?

from which it looks as if g_locale_to_utf8 has somehow not done
the right thing on a Windows filename,

You mean a file name in the encoding the C library uses, or the
encoding GLib and the GTK+ stack uses? GLib and GTK+ use UTF-8 for
file names on Windows in their API; all GLib and GTK+ API that accept
/ return file names (or other strings to / from the system like
environment variable names or values) accept / return them in UTF-8.

which was apparently in
some Unicode representation and not the old-style Windows
codepage.

Seems like it is the GLib file name encoding then, i.e. UTF-8. It's
not correct to use g_locale_to/from_utf8() on such file names. Use
g_filename_to/from_utf8(). (Which on Windows is a no-op conversion
from UTF-8 to UTF-8, but on Unix might actually do something.)

--tml



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