Re: auto-upgrading strings to utf8



On Sun, Jun 05, 2005 at 15:59:15 -0400, muppet wrote:
[...]
The GstFileSrcElement's set_property handler does nothing special to  
the string -- it just copies it, and then later passes it, unaltered  
to open().  So, it expects the string to have been a valid filename.

But since it was passed through a G_TYPE_STRING property, and we  
consider G_TYPE_STRING to mean "utf8 text", we mangled it.


I can think of three fixes for this:

a) if it's the case that a G_TYPE_STRING really is supposed to be  
utf8, then GstFileSrcElement is broken, and should do something like  
g_filename_from_utf8() on the string it gets from the location  
property.  the bindings would have to do nothing.  this risks  
breaking C programs, but GStreamer is still at a nonstable version...

May I bring the G_BROKEN_FILENAMES environment variable to your
attention...? **The code quite well can g_filename_from_utf8**. It's
just that that function is a NOP unless G_BROKEN_FILENAMES is set. It is
arguable whether having filenames in locale encoding is broken, but Gtk
people think so.

Now yes, this is the right solution -- the G_TYPE_STRING must be
supposed to be utf8 for sake of general sanity.

b) turn off auto-upgrading, and push the burden of ensuring utf8-ness  
of text onto perl developers.  this risks breaking lots of existing  
code.

c) add infrastructure to the bindings to allow per-property overrides  
for marshaling.  this would slow down the general case and take up  
even more memory (another hash table and lookup per property), but  
would allow problems like this (and G_TYPE_POINTER properties) to be  
fixed.


--
Holy crap, dude, we have kids!
    -- Elysse, six days after giving birth to twins

_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

-------------------------------------------------------------------------------
                                                 Jan 'Bulb' Hudec <bulb ucw cz>

Attachment: signature.asc
Description: Digital signature



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