Mixing GLib and system file name encoding



Hello, I have a file that contains names of other files (in the same
directory) and need to load these other files when the user selects the
list file.  Easy.

Except that the file was created by a MS Windows program and the names
are in system encoding (whatever it means, usually something like
CP1252).  Gtk+ functions provide the name in UTF-8 and on Win32 the GLib
encoding is also UTF-8.  So all I can get from Gtk+ and GLib functions
are UTF-8 encoded paths.

To load the referenced files it is necessary to either:

- 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

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

But I don't know how to do either reliably.  Is there anything in GLib
that can help me?

Yeti



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