Re: Help with UTF8 needed.
- From: Thomas Bayen <tbayen bayen de>
- To: Gtk-Perl-List <gtk-perl-list gnome org>
- Subject: Re: Help with UTF8 needed.
- Date: Wed, 03 Dec 2003 10:04:26 +0100
Alberto Manuel Brandão Simões schrieb:
> Hi.
> I am trying to use gtk-perl and started with a too simple example: a
> dicionary saved directly to a DB file. I'm sending the simple 86 line
> of code in attach in case it can help.
>
> The problem is that if I use latin1 characters in the key for the DB
> file, when I retrieve it again, I got a UTF8 string, which is not
> interpreted as such by Perl.
>
> It is not simple to explain, so please test the app with the following
> test case:
> insert 'cão' as term and 'foo bar' as data
> exit the application
> re-enter the applicaiton
I haven't testet your application but perhaps your problem is more a
mldb-problem than a gtk-problem. My experience is that gtk is very clean
and consistent in using only utf8 strings. I am writing german programs
(with german "umlaut" äöü) for a long time and it ever has been a very
confusing theme. If you want to know my opinion: I always try to use
everywhere uft8 because this is the only real solution. It's only
drawback is the difference between byte length and char length. And this
may be a problem in some databases (That's where we are with MLDB?).
1. If you decide to use utf8 everywhere you should really say
"everywhere": In your console, your files, your editor, your sourcecode
etc. That's my way and it works well if you have set up it correctly one
time. You should read
* perldoc utf8
* perldoc encoding
* perldoc perluniintro
* perldoc perlunicode
* perldoc perlrun (-C switch)
I don't know if MLDB ist really utf8-safe. Try it out.
2. If you want to change just the encoding you should also RTFM
mentioned above to get the needed know-how but you should read
* perldoc Encode
too and use this. Look out for encode(), is_utf8() and friends.
> Thanks in advance.
> Best regards,
> Alberto Simões
HTH,
Thomas Bayen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]