Re: filename encoding issues completely broken in glib (and likely also gtk2)?
- From: Marc Lehmann <schmorp schmorp de>
- To: Torsten Schoenfeld <kaffeetisch gmx de>
- Cc: gtk-perl-list gnome org
- Subject: Re: filename encoding issues completely broken in glib (and likely also gtk2)?
- Date: Tue, 1 Apr 2008 10:16:31 +0200
On Mon, Mar 31, 2008 at 09:39:07PM +0200, Torsten Schoenfeld <kaffeetisch gmx de> wrote:
Thanks for the very clear explanation.
What does all this boil down to, though? How should the GPerlFilename
typemap look?
The typemap is not the problem, the problem is using it in functions
expecting a filename.
The correct typemap for filenames would simply use SvPVbyte to extract
the filename (this is when *pathnames* are being used to access the
filesystem, its a different story when using filename strings for display
- it all depends on what the glib function requires as input).
I also researched windows: perl on windows currently supports only
ascii-filenames correctly (due to rather big bugs), but most of the
built-in functions expect an ANSI filename, so SvPVbyte is the right thing
on windows, too, meaning that currently, files under windows are also not
accessible if they don't happen to be utf-8-encoded, which most aren't,
as windows doesn't support utf-8, so the current situation is even more
problematic under windows.
If it can't be fixed, which new typemaps do we need and
what should they do?
It's simply not as simple as slapping a typemap entry on everything - just as
it isn't correct to slap an T_IV typemap entry onto every int, it is wrong to
slap the same typemap entry for every filename argument - the glib
documentation usually documents this corretcly:
When it mentions "filename encoding", the correct interface is SvPVbyte.
when it mentions "utf-8 encoded", then one could either use SvPVbyte
(truthful but not very useful translation) or SvPVutf8 (the de-facto
standard which is also useful, but changes the API between perl and C, as
C expects an UTF-8 string, while perl users must not pass in utf-8 strings
but unicode strings instead).
--
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]