RFC: Glib charset stuff



Hello All,

It startled me recently, that Glib-perl exports the filename conversion
functions, but not the rest of the iconv stuff. Is there any particular
reason it does not include them, or just noone needed them yet?

I agree that perl strings should be utf-8 in a gtk2-perl application.
But that is exactly it -- strings read from files, passed as parameters
etc. will be in local encoding. And perl's support for this is not too
good -- I failed to find a simple way to say something should be recoded
from systems default encoding (as determined from LC_CTYPE) -- that is
without including another, otherwise useless, module manualy.

So I suggest that Glib module (since glib does this finding out
automaticaly) exports the g_get_charset function (at minimal). That way
one can simply say:

use Glib;
use encoding Glib->get_charset;

Instead of:

use Glib;
use I18N::Langinfo qw(langinfo CODESET);
use encoding langinfo(CODESET);

(I'd prefer Glib->charset or glib_charset, though it would be
incosistent with naming scheme a little).

In addition it would be nice if glib registered an alias (calling
Encode::Alias module) for that encoding. Say 'local' or 'system'. Then
above would be just:

use Glib;
use encoding 'local';

and in addition ':encoding(local)' would work for open and/or binmode
(function calls do not interpolate, so this would be simpler).

The rest of iconv stuff is not essential (Encode module can be used),
but I would really like to see at least the charset detection.

-------------------------------------------------------------------------------
                                                 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]