filename encoding issues completely broken in glib (and likely also gtk2)?



Hi!

I know, I was away for quite a long time, but now coming back, it seems
that only ascii filenames can be made to work properly with the glib perl
modules. Just found that out the hard way :().

For example, the perl version of g_bookmark_file_load_from_file interprets
the filename as a unicode string, as opposed to a locale-encoded string
as the glib function does.

As a direct result of this:

a) many filenames are simply inaccessible to perl programs (while they work
   perfectly fine with c programs that have access to the proper API).
b) even filenames in utf-8 are inaccessible, as perl, like any other
   language, handles filenames as binary data, while the Glib perl module
   forces this binary data to be reinterpreted as utf-8, so a filename
   originally encoded as utf-8 fails to work properly.

This effectively reduces the filenames supported by glib-perl to the ascii
characters.

I understand that I am partially responsible for this because I chose bad
names for the filename functions, which subsequently got used for lots
of glib functions that expect filenames, while they were mostly meant
for functions expecting utf-8 encoded filenames.

In short, while const char * is wrong for filenames, so is almost
every use of GPerlFilename when the underlying c function expects a
"glib-filename-encoded" path. There is no suitable typemap entry for
filenames at the moment (which should use SvPVbytes for all functions
taking "glib filename encoding" and SvPVutf for all functions taking utf-8
encoded strings).

The question is how to proceed and clean up that mess.

(In the past, glib had similar problems by forcing the API to use utf-8,
but fortunately most or even all of this has been fixed on the glib side).

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      pcg goof com
      -=====/_/_//_/\_,_/ /_/\_\



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