[issue19846] Python 3 raises Unicode errors with the C locale

STINNER Victor report at bugs.python.org
Tue Dec 10 11:36:37 CET 2013


STINNER Victor added the comment:

2013/12/10 Martin v. Löwis <report at bugs.python.org>:
> >From what I read, it appears that the SO posting is plain wrong. Consider, for example,
>
> https://developer.gnome.org/glib/stable/glib-Character-Set-Conversion.html#g-filename-to-utf8
>
> # Converts a string which is in the encoding used by GLib for filenames
> # into a UTF-8 string. Note that on Windows GLib uses UTF-8 for filenames;
> # on other platforms, this function indirectly depends on the current locale.
>
> The SO author might have misread the part where it says that glib uses UTF-8 *on Windows* (instead of the braindead "ANSI" encoding indirection).

I wrote some notes about glib here:
http://unicodebook.readthedocs.org/en/latest/libraries.html#the-glib-library

g_filename_from_utf8() uses the g_get_filename_charsets() encoding.
g_get_filename_charsets() is the ANSI code page on Windows and the
locale encoding on Linux, except if G_FILENAME_ENCODING or
G_BROKEN_FILENAMES environment variables are set.

glib has a nice g_filename_display_name() function.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19846>
_______________________________________


More information about the Python-bugs-list mailing list