Oracle characterSet setting

257 views Asked by At

I have a problem with special chars like "Ñ", "á" using adodb in ORACLE: when save in varchar2/varchar field de table save other char "¿".

if connect with oci8 conect (direct to oracle) special char are correctly save.

How to set a characterset when connect ?

($db->Connect(TNS_database, USER, PASSword));

Thanks !!!

1

There are 1 answers

1
Christopher Jones On

With ADOdb, you should set the Oracle 'client' (i.e. PHP OCI8) character set. There are two ways to do this:

  • In the shell that starts PHP you could set the environment variable NLS_LANG to something like ".AL32UTF8" (with the leading full stop). If PHP is invoked from a web server, then you need to make sure you set this variable in the right place with the right syntax.

  • Alternatively you can use some ADOdb function like setConnectionParameter or maybe setCharSet. It's not clear to me the exact syntax to use for Oracle. You will need to do some debugging through the stack. What you want is $this->charSet in https://github.com/ADOdb/ADOdb/blob/v5.21.0/drivers/adodb-oci8.inc.php#L253 to be the string AL32UTF8.