|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45659 wrong size of japanese character
Submitted: 2008-07-30 07:56 UTC Modified: 2008-07-31 22:08 UTC
From: cuichangjie at gmail dot com Assigned: sixd (profile)
Status: Closed Package: OCI8 related
PHP Version: 5.2.6 OS: windows xp
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: cuichangjie at gmail dot com
New email:
PHP Version: OS:


 [2008-07-30 07:56 UTC] cuichangjie at gmail dot com
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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-30 20:08 UTC]
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-31 04:27 UTC] cuichangjie at gmail dot com
Oracle DB                   :
Oracle client versions      :
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-31 22:08 UTC] cuichangjie at gmail dot com
It is my mistake for using wrong charset with DB.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jul 17 19:01:29 2024 UTC