[tpm] Using DBD::Oracle and UTF8

J. Bobby Lopez jbl at jbldata.com
Wed Mar 25 11:28:31 PDT 2009


I'm using DBD::Oracle to communicate with Oracle 10g (10.2.0.4)

All works well, except that I find I have to use the following environment
variable for the Oracle client, in order to have data sent to my perl script
in UTF8 format.

No biggy, here's the environment variable:
$ENV{NLS_LANG}      = "AMERICAN_AMERICA.UTF8";

Problem is though, even with UTF8, there are still (a small number) of
characters that do not get translated correctly.

The characters that I'm having trouble with seem to show up fine when using
the regular "Western (ISO-8859-1)" character set.

So far I've considered three options as work-arounds:

1) Have the database keep track of the character set that required to
correctly display the data for each record

   - complexity = high
   - elegance = unattractive

2) Provide an option in the UI to switch between character sets

   - complexity = medium
   - elegance = ugly

3) Detect questionable characters in the incoming data, and automatically
switch character sets before output to end user

   - complexity = unknown (if the data comes back as "??", what if they were
   supposed to be actual question marks??)
   - elegance = could be worse


Any thoughts on how this could be done in a more elegant and less complex
way?


-- 
J. Bobby Lopez
Web: http://jbldata.com/
Twitter: http://www.twitter.com/jbobbylopez
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20090325/9422d804/attachment.html>


More information about the toronto-pm mailing list