Forum OpenACS Q&A: PHP character encoding problem

Collapse
Posted by Evica Ilieva on
Hi to all
I have a problem. I connect Oracle with php. It works, but it has two problems. ( I have two problems).
It withdrows all the columns twice, and doesnt show the data which is put in the data base with cyrilic encoding. THe encoding of the data base is UTF-8. Also I tried to set the encodung in HTML - PHP code UTF-8,but it doesn't work.
I have the same problem with mySql. But I find SQL query which soles this problem. the code is "mysql_query("set names cp 1251"); ", which is inserted right after the code for connection with the databese.
I try this query with oracle, but it doesn't work.

Please help!

Evica

Collapse
Posted by brad chick on
I am having trouble getting Chinese characters in/out of oracle with AOLserver. Here is my stack:

Oracle 11g
TCL 8.5
AOLserver 4.51
Oracle Driver version 2.7

The existing database has a database character set of WE8ISO8859P1.
But we are using NCHAR and NVARCHAR2 datatypes to store Unicode characters. The
NLS_NCHAR_CHARACTERSET is properly set to AL16UTF16.

I am setting the following in the environment as an nsd wrapper:

export NLS_LANG=_.UTF8

I can login to sqlplus and insert and select chinese characters:

insert into test_zhs (foo) values (N'男孩儿男孩儿');

SQL> select * from test_zhs;

FOO
--------------------------------------------------------------------------------
男孩儿男孩儿

I also am sure that aolserver/tcl are treating the characters appropriately.
For example, this form takes whatever characters are inputed into the form, tries to insert them, and spits them back out.
When chinese characters are inputed, that is how the server returns them.
http://jp.xacte.com:8181/test/db/myform.tcl

On the other hand, no matter what I try, I can't get aolserver to get them into oracle properly. I suspect it's the oracle
driver, but people have suggested that it is possible to put unicode characters into oracle using that driver.

Any help would be way helpful.

Thanks