|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-07-09 13:11 UTC] thies at cvs dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 21 21:00:01 2025 UTC |
Sorry,I can't modify the bug id 5341 repost in details ================================================== Version Affected : both 3.0.16 & 4.0.1 & 4.0.1pl2 Oracle version : 8.1.5 OS : Solaris 2.6 105181-20 WEB server : NES 3.6 NLS_LANG=ZHS16CGB231280 PHP can't work fine with chinese string in the query, both insert and select.It seems that PHP trunck the 8bit chinese text string to 7bit ascii text.The cgi program set the NLS_LANG parametre the sam as db server. But sqlplus work well. attention: there are some chinese text,you must have some software that can display it. source code: --------------------------------------- <?php putenv("LD_LIBRARY_PATH=/u01/app/oracle/product/8.1.5/lib"); putenv("nls_lang=_china.zhs16cgb231280"); putenv("ORACLE_BASE=/u01/app/oracle"); putenv("ORACLE_HOME=/u01/app/oracle/product/8.1.5"); putenv("ORACLE_SID=oracle8"); putenv("ORA_NLS33=/u01/app/oracle/product/8.1.5/ocommon/nls/admin/data "); $conn = OCILogon("scott","tiger"); OCIInternalDebug(1); $stmt = OCIParse($conn,"insert into emp (empno,ename) values (3,'中文字 体') returning ename into :name"); OCIBindByName($stmt,":name",&$name,32); OCIExecute($stmt); while (OCIFetch($stmt)) { echo "ename:".$name."\n<br>"; } OCIFreeStatement($stmt); OCILogoff($conn); ?> --------------------------------------- error message: --------------------------------------- OCIDebug: oci_parse "insert into emp (empno,ename) values (3,'中文字体 ') returning ename into :name" id=4 conn=3 Warning: OCIStmtExecute: ORA-24365: error in character conversion in / usr/netscape/suitespot/docs/q.php on line 13 Warning: OCIFetch: ORA-24374: define not done before fetch or execute and fetch in /usr/netscape/suitespot/docs/q.php on line 14 OCIDebug: START _oci_stmt_list_dtor: id=4 last_query="insert into emp (empno,ename) values (3,'中文字体') returning ename into :name" OCIDebug: _oci_bind_hash_dtor: OCIDebug: END _oci_stmt_list_dtor: id=4 OCIDebug: START php_rshutdown_oci OCIDebug: END php_rshutdown_oci OCIDebug: START _oci_conn_list_dtor: id=3 OCIDebug: END _oci_conn_list_dtor: id=3 OCIDebug: _oci_close_session: logging-off sess=2 OCIDebug: START _oci_close_server: detaching conn=1 dbname= ---------------------------------------------------------------- About the database: ---------------------------------------------------------------- $ sqlplus SQL*Plus: Release 8.1.5.0.0 - Production on Fri Jul 7 13:15:16 2000 (c) Copyright 1999 Oracle Corporation. All rights reserved. Enter user-name: scott Enter password: Connected to: Oracle8i Enterprise Edition Release 8.1.5.0.0 - Production With the Partitioning and Java options PL/SQL Release 8.1.5.0.0 - Production SQL> select * from emp; EMPNO ENAME JOB MGR HIREDATE SAL COMM ---------- ---------- --------- ---------- --------- ---------- ------ ---- DEPTNO ---------- 3 VPNDWVLe SQL> insert into emp (empno,ename) values (1,'中文字体'); 1 row created. SQL> select * from emp; EMPNO ENAME JOB MGR HIREDATE SAL COMM ---------- ---------- --------- ---------- --------- ---------- ------ ---- DEPTNO ---------- 3 VPNDWVLe 1 中文字体 SQL> ---------------------------------------------------------------- analysis: ---------------------------------------------------------------- The character set of oracle is simplified chinese, There is no problem when manipulating database with sqlplus, The problem is the interface with php and oracle. $ oerr ora 24365 24365, 00000, "error in character conversion" // *Cause: This usually occurs during conversion of a multibyte // character data when the source data is abnormally terminat ed // in the middle of a multibyte character. // *Action: Make sure that all multibyte character data is properly te rminated. $ Without the second error message,the first will not display, but the data it insert into the database is asccii ,too. ----------------------------------------------------------------