----- Original Message ----- 
From: "angie ahl" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, December 01, 2004 9:26 AM
Subject: Unicode (utf8) and MySQL (with Perl)


> Hi List.
>
> Please excuse the cross posting but I've been scouring the archives
> and no joy as yet.
>
> I'm trying to get Perl and MySQL using utf8 happily and I've followed
> several tutorials but am not getting the same results.
>
> I've got a load of utf8 characters like so (perl):
>
> my %uni = (
>         hebrew_alef => {
>                 character => chr(0x05d0),
>                 language => "hebrew",
>         },
>         smiley => {
>                 character => "\x{263a}",
>                 language => "none",
>         },
> );
>
> I am inserting them into MySQL using the dbi module DBD::MySQL
>
> The tutorial said to insert the values like this:
> INSERT INTO unitest (id, aword) VALUES ( "smiley",
> CONVERT(_utf8'\x{263a}' USING utf8) );
>
> get the values back like this:
> select aword from unitest where id = "smiley;"
>
> then use perl to decode the returned value like so:
>
> decode("utf8", $aword)
>
> This doesn't work for me properly. However when I insert them like this:
>
> INSERT INTO unitest (id, aword) VALUES ( "$smiley", '\x{263a}' );
>
> It seems to work for all but the hebrew_alef which is the character
chr(0x05d0)
>
> So here's my questions:
>
> Is chr(0x05d0) a unicode character?
>
> Do we need to use CONVERT to insert data (it's seems to working better
> without it here, but I don't understand CONVERT and the manual didn't
> clear that up for me), or should we be inserting utf8 chars the
> standard way.
>
> I'm using mysql 4.1.7 and perl 5.8.1 on OS X 10.3
>
> TIA I'm struggling now.
>
I can't help with very much of your question because I haven't really worked
with character sets in MySQL. However, I can tell you that 0x05d0 *is* the
Unicode value of aleph in Hebrew. You can see the entire Hebrew Unicode
character set at http://www.unicode.org/charts/PDF/U0590.pdf to confirm this
for yourself (and look up other Hebrew codes).

To see all of the Unicode charts, go to http://www.unicode.org/charts/.

By the way, I don't know if you've examined it already but there is a full
chapter in the MySQL manual on character sets which may answer some of your
questions. See http://dev.mysql.com/doc/mysql/en/Charset.html.


Rhino


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to