Re: auto-upgrading strings to utf8



* muppet <scott asofyet org> [2005-06-05 22:05]:
I can think of three fixes for this:

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.

That is so wrong. In the default case, auto-upgrading is the
right thing to do. We know there are so edge cases which require
special treatment. Making the default case require extra work so
that the edge cases do not is just ass backwards and would
introduce subtle bugs where people forget these things.

Think of SQL injection vulnerabilities; people constantly forget
where they have to quote things and where not. Of course, for SQL
queries this is difficult to solve; but why introduce the same
kind of subtlety into an API where itâs simple to avoid?
 
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...

Unless thereâs an actual, non-obvious, but compelling reason for
GStreamer to do otherwise, thatâs clearly the correct solution.

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.

That would be the right thing to do if GStreamer does have reason
for doing things the way it does (rather than it being a simple
oversight).

Would there be a way to do this specifically within the GStreamer
bindings (a special overridden version of Glib::Object::set(),
say) rather than penalizing all of Gtk2-Perl for it?

If there is a way to do this only within GStreamer, maybe the
same mechanism could be available from base Gtk2-Perl to all
bindings which need to make use of such, but as an opt-in option
that does not penalize those which donât?

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1};
&Just->another->Perl->hacker;



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