Wednesday, December 19, 2007

Oracle, modPerl, and french accents

Since moving from one Linux server to another, our modPerl application had a hard time saving accented characters from the french language (éàè etc...). The characters were saved in the database as upside-down question marks, or at least that's how my TOAD installation displayed them.

It was determined that in order to overcome this problem, we needed to set the NLS_LANG environment variable to the value 'AMERICAN_AMERICA.WE8ISO8859P1'.

But setting that variable in the Apache user's profile doesn't work, nor does setting it through httpd.conf's PerlSetEnv statement.

We had to set it in a Perl script that is loaded through the PerlRequire statement in httpd.conf (I called that script startup.pl). Not only that, it needed to be set in the BEGIN block of that script :

BEGIN {
$ENV{ORACLE_HOME} = '/u01/app/oracle/product/10.2.0/client_1/';
$ENV{NLS_LANG} = 'AMERICAN_AMERICA.WE8ISO8859P1';
}

This is documented elsewhere on the web, but it doesn't hurt to have it here :-)

Humbly...

No comments:

Post a Comment