Re: Mixing GLib and system file name encoding



Hello.

> - convert the names from the list to GLib encoding (UTF-8) and combine
>  it with the directory name of the list file and use g_fopen() to open
>  the files

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().

> - convert the directory name of the list file from GLib encoding to the
>  system encoding and use fopen() to open the other files

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().


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.

Hope this helps a bit.

Tadej

-- 
Tadej Borovšak
tadeboro.blogspot.com
tadeboro gmail com
tadej borovsak gmail com


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