#36797 [Asn->Fbk]: Problem using UTF-8 database with pdo_oci

From: Date: Sat, 25 Apr 2009 14:38:03 +0000
Subject: #36797 [Asn->Fbk]: Problem using UTF-8 database with pdo_oci
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-136240@lists.php.net to get a copy of this message
ID: 36797 Updated by: jani@php.net Reported By: mauroi at digbang dot com -Status: Assigned +Status: Feedback Bug Type: PDO related Operating System: Win XP SP2 -PHP Version: 5.1.2 +PHP Version: 5.2.4 Assigned To: ramsey New Comment: Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://windows.php.net/snapshots/ Previous Comments: ------------------------------------------------------------------------ [2008-10-03 13:55:26] neggelandia at hotmail dot com I just finished setting up OCI8 to connect to an Oracle database server and I noticed that Swedish characters (åäö and ÅÄÖ) end up as ??? in my web browser. I'm running Oracle Instant Client on an Ubuntu 8.04 web server with PHP 5.2.4 (latest version at the time of writing). I tried Ramsey's advice and added the SetEnv NLS_LANG line to Apache but nothing happened. I can't try step one 'cause I'm not connecting using the tnsnames.ora parameters (I use the easyconnect method or whatever it's called). I don't have the folder mentioned in step 3 (I only installed Oracle IC Basic and SDK) so I can't do that either, but the whole $ORACLE_HOME directory is chmoded to 777 so it shouldn't be a problem. This bug is quite important to me as I need to be able to get some data from the Oracle DB to PHP, and as I'm working for a Finnish/Swedish company there are lots of these characters everywhere. Sure it's readable but it's still annoying and just not perfect. I hope someone takes the time to fix this bug or come up with a working workaround. ------------------------------------------------------------------------ [2007-06-06 20:39:56] ramsey@php.net Assigning to myself to update the PDO_OCI documentation to include discussion about setting charsets for Oracle. ------------------------------------------------------------------------ [2007-06-06 20:02:18] ramsey@php.net maggie@intermaggie.com and I debugged this issue for hours, and here's what it came down to. We fixed this issue by doing the following: 1. As suggested, the DSN string was modified to contain 'charset=AL32UTF8' 2. Apache now has an environment variable NLS_LANG set as follows: NLS_LANG='AMERICAN_AMERICA.AL32UTF8' 3. Make sure that $ORACLE_HOME/nls/data and all files within are world-readable. ------------------------------------------------------------------------ [2007-06-05 19:15:39] pajoye@php.net As information, I use 'oci:...charset=AL32UTF8' with latest IC and oracle 10g as server and works (5.2.2 and cvs). ------------------------------------------------------------------------ [2007-06-05 18:45:56] ramsey@php.net Note that I'm not using HTML entities in the field, but rather, actual Japanese characters. The bug report here appears to convert these chars to HTML entities. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/36797 -- Edit this bug report at http://bugs.php.net/?id=36797&edit=1

« previous php.bugs (#136240) next »