ID: 45659 User updated by: cuichangjie at gmail dot com Reported By: cuichangjie at gmail dot com -Status: Open +Status: Closed Bug Type: OCI8 related Operating System: windows xp PHP Version: 5.2.6 Assigned To: sixd New Comment:
It is my mistake for using wrong charset with DB. Previous Comments: ------------------------------------------------------------------------ [2008-07-31 04:27:49] cuichangjie at gmail dot com Oracle DB : 10.2.0.1.0 Oracle client versions : 10.2.0.1.0 What is the DB characterset : AL32UTF8 NLS settings used by PHP : putenv("NLS_LANG=Japanese_Japan.JA16SJIS"); Do you specify a character set in oci_connect(): no I see the problem what is, the putenv() set a wrong characterset for DB, when i have changed putenv() to AL32UTF8, the strlen() can get the same length with db for janji. ------------------------------------------------------------------------ [2008-07-30 20:08:09] [EMAIL PROTECTED] Please give Oracle DB and Oracle client versions. What is the DB character set and what are the NLS settings used by PHP? Do you specify a character set in oci_connect()? ------------------------------------------------------------------------ [2008-07-30 07:56:13] cuichangjie at gmail dot com Description: ------------ When insert some japanese charectar (encoding type is "SJIS") using OCIBindByName and oci_execute, oracle has return the ORA-12899 error,it is seems like some addition bytes has been added after OCIBindByName. Reproduce code: --------------- //a table with 2 column, //empno -- number(1) //ename -- varchar2(6) $stmt = oci_parse($conn, " INSERT INTO emp (empno, ename) VALUES( :0, :1)"); $ret = OCIBindByName(stmt, ':0', 1); //error check ... $ret = OCIBindByName(stmt, ':1', '日本語'); //error check ... $ret = oci_execute($stmt); //error check ... oracle's error shows : ORA-12899: value too large for column "USER0"."MyTable"."ename" (actual: 9, maximum: 6)] Expected result: ---------------- The string: '日本語' should be 6 bytes, echo strlen('日本語'); //should show us : 6 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=45659&edit=1