Re: Mixing GLib and system file name encoding



On Mon, Nov 29, 2010 at 06:53:20PM +0100, Tadej Borovšak wrote:
> You can use g_locale_to_utf8() to convert names in the list to UTF-8,
> which can then be fed along with base directory to g_build_filename()
> or something similar and opened using g_fopen().
> ... 
> g_locale_from_utf8() can be used to convert base path to system
> encoding. After that you can concatenate it with filename from your
> list and open it using fopen().

Thanks, once I knew better what to look for I also found
g_win32_locale_filename_from_utf8() which seems to be just what's needed
in the second case.

> Note that both methods will only work if your input file is indeed
> encoded in system locale. If your file originates from other system
> that uses different locale, you're basically screwed.

Yes, I know, <sigh>.

Regards,

Yeti



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