Re: Mixing GLib and system file name encoding

2010-11-30 Thread David Nečas
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, .

Regards,

Yeti

___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list


Re: Mixing GLib and system file name encoding

2010-11-29 Thread Tadej Borovšak
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
tadeb...@gmail.com
tadej.borov...@gmail.com
___
gtk-list mailing list
gtk-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-list