perlfellas has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I want to insert Unicode characters into a field in Oracle table. The field’s data type is varchar2. perl version is 5.8.0. I am inserting values from a hash. When I print the hash it displays the proper character but when I search for the char é(one of Unicode charset) it does not match. Could anyone please help me to resolve this problem?

Considered: tphyahoo: title change: Unicate Charset Problem in Oracle

20050322 Unconsidered by Corion: No decision: Keep/Edit/Delete: 11/11/0

Replies are listed 'Best First'.
Re: Unicode Charset Problem
by borisz (Canon) on Mar 21, 2005 at 13:22 UTC
    Perhaps your database loose the UTF8 flag for the string. Check that with Devel::Peek and update the string from the database with $str = Encode::decode('utf8', $str ); or a similar function.
    Boris
Re: Unicode Charset Problem
by halley (Prior) on Mar 21, 2005 at 14:50 UTC
    This is not a complete answer.

    You can't store "Unicode characters," you can only encode them into bits and bytes that can be stored.

    You haven't said if your hash contains UTF-8, ISO8859-1, or some other encoding. The "é" is a character, but its representation is different in each encoding. If any part of the process does not handle the encoding or decoding correctly, it ends up with some other character, or it ends up as invalid and undecypherable bits.

    If the database supports UTF-8 encoding, then talk in terms of UTF-8 encoded strings, not simply "Unicode characters."

    You may also want to read my prior writeup, FMTYEWTK about Characters vs Bytes.

    --
    [ e d @ h a l l e y . c c ]