Re: A question of UTF-8
- From: Christian Borup <borup borup com>
- To: gtk-perl-list <gtk-perl-list gnome org>
- Subject: Re: A question of UTF-8
- Date: 08 Jun 2003 11:53:26 +0200
On l?, 2003-06-07 at 23:52, René Seindal wrote:
I have an application that is a frontend for a database which then
drives a web-site.
The database is in ISO-8859-1 with loads of European 8-bit characters.
Gtk2 and perl 5.8 prefers utf8.
Thats not quite true. Gtk2 requires utf8, perl5.8 mostly tolerates it...
The only thing I do to confront the situation is that on saving data to
the database, I convert everything to ISO-8859-1 using
Encode::encode('ISO_8859-1', $data).
Apparently it works, mostly due to the magic worked by perl 5.8, I
guess.
That should be enough. What gtk-perl-xs does is to upgrade the strings
to utf8 on every call (if needed). Likewise every string returned from
gtk-perl-xs is marked as utf8 (just setting the flag - no upgrade
needed).
If you are working in a iso-8859-1 locale encode('iso-8859-1' ...)
should be a non-op if the string is not marked as utf8.
Btw you really should be using 8859-15 some of you users might want to
use a Euro sign (€) not available in 8859-1.
Do anybody have experience with these things?
Are there pitfalls I should be aware of?
The last thing I want is to find most of my database doubly encoded to
utf8 :-(
Been there - it sucks if you get it wrong.
The database is Mysql 4.0.13. Mysql 4.1 supports utf8 directly, which
should make life a lot easier.
I have big hopes for that too. I too am stuck with mysql at work.
Someone should do a gtk-perl-xs based DBI shell, that would be sweet.
./borup
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]