Read the Unicode chapter in the DBD::Oracle documentation, it explains exactly what has to be done to read and write Oracle Data as UTF-8. Make sure that other I/O from and to perl is also UTF-8, so your strings contain unicode characters (utf8 flag on) and not bytes representing a random unicode encoding (utf8 flag off). See also the tests t/40UnicodeRoundTrip.t and t/41Unicode.t in DBD::ODBC for some basic examples.
Alexander
--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
| [reply] |
How would your hypothetical script know to convert Internationalization back to Ïntêrnatïônàlîzâtion instead of Internätiönälizätiön?
If you want to save your data as Unicode data, you'll have to look at how your database driver (likely DBD::Oracle) stores character data in a character set encoding. You will also have to make your whole processing pipeline from input to storage and back to output respect that encoding. If you want to use ASCII-encoded data to search for your other encoded data, you will have to add a second column to your data table in which you store the asciification.
| [reply] [d/l] [select] |
To supplement the excellent advice given above, I'd like to add that you should take care to know your display tools really well, to make sure that valid utf8 data is displayed correctly. This involves whatever text editor, terminal window, browser or other display method you use to check your data. It can also be a good idea to have two or more independent ways to look at the contents of the database.
It will help to have tools that allow you to view utf8 text data in a more detailed, explicit manner -- for example (shameless plug), I posted a couple command-line scripts that can help for both confirming valid utf8 data and diagnosing faulty data: tlu -- TransLiterate Unicode, and unichist -- count/summarize characters in data. They might help you in figuring out a suitable idiom for handling your text data in a way that avoids corruption. | [reply] |
| [reply] |