Problems? Is your data what you think it is? | |
PerlMonks |
Solved: Preserving UTF-8 characters in Oracle and XMLby poltr1 (Novice) |
on Nov 07, 2011 at 21:47 UTC ( [id://936587]=perlquestion: print w/replies, xml ) | Need Help?? |
poltr1 has asked for the wisdom of the Perl Monks concerning the following question: (Actually, this isn't a question, but a solution in case others are looking for the same nugget of wisdom.) I have incoming data in XML that's UTF-8 encoded. It includes special symbols such as nonbreaking spaces, the registered trademark symbol (R), the "TM" symbol, Greek letters, etc. This data is being put into an Oracle database via script that reads the XML, parses it using XML::Twig, and saves it to the database via DBI. In order to preserve these characters, here's what I had to do: 1) Add this line to Perl scripts:
2) Add the encoding qualifier to any 'open' statements on files that contain UTF-8:
3) Add this line if interfacing with an Oracle database:
4) Modify the Oracle login to include the 'ora_charset => "UTF8"' attribute in the connect string:
5) If processing XML files with encoding="UTF-8" via XML::Twig, add the output_encoding attribute to the call:
Back to
Seekers of Perl Wisdom
|
|