#40664 [Com]: String conversion functions wrong for multibyte chars

From: Date: Sun, 22 Mar 2009 10:12:26 +0000
Subject: #40664 [Com]: String conversion functions wrong for multibyte chars
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-134987@lists.php.net to get a copy of this message
ID: 40664 Comment by: j dot novak at netsystem dot cz Reported By: fjortiz at comunet dot es Status: Assigned Bug Type: COM related Operating System: Win32 PHP Version: 5.2.1 Assigned To: wez New Comment: I see same problem with ADODB.Connection and it's parameters. When I use: // init connection to DB $dbc = new COM('ADODB.Connection',null,CP_UTF8); $dbc->Open("PROVIDER=MSDASQL;Driver={SQL Server};Server=192.168.210.1;Database=test;UID=test;PWD=test"); // create command $oCmd = new COM('ADODB.Command',null,CP_UTF8); $oCmd->ActiveConnection = $dbc; // // Table test1 has one row c1 of type nvarchar(200) $oCmd->CommandText = "INSERT INTO test1(c1) VALUES (?)"; $oCmd->CommandType = 1; // Some UTF-8 string (length in characters is 15, 24 in bytes) $val='ABCříšúěďáéóXYZ'; $len=strlen($val); $p=$oCmd->CreateParameter('name',202,1,$len,$val); $oCmd->Parameters->Append($p); $oCmd->Execute(); // ADODB sends to DB nvarchar(24) which is length of string // in bytes not characters, but data has 15 characters // in UCS-2. So in database there is correct string, but there is // some garbage after end of string Previous Comments: ------------------------------------------------------------------------ [2008-10-22 14:05:22] vincent at eal dot com Any update on this bug? I still have the problem with PHP 5.2.3 and the changelog does not indicate any fix in 5.2.6. It is very annoying to have a nice patch standing there still with no one to commit it to CVS. ------------------------------------------------------------------------ [2007-08-15 08:36:07] jani@php.net Assigned to the maintainer. ------------------------------------------------------------------------ [2007-07-25 14:28:09] ameoba32 at gmail dot com i found this bug too, so code is like this: $word = new COM("Word.Application", null, CP_UTF8); $word->Visible = true; $doc = $word->Documents->Add(); $word->Selection->TypeText( "UTF8 text here, russian in my case" ); In word appears "Normal text " + garbage. can this be fixed in CVS ? i have to compile php on win32 by myself ;) ------------------------------------------------------------------------ [2007-05-28 15:07:30] tony2001@php.net Unfortunately the extension is currently unmaintained, so I don't think anybody is going to commit your patch in the nearest future. ------------------------------------------------------------------------ [2007-05-23 11:51:16] fjortiz at comunet dot es Any updates about this?. I'm showing you the code so fix the issue. Please tell me what else you may need to carry this into the main tree. TIA ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/40664 -- Edit this bug report at http://bugs.php.net/?id=40664&edit=1

« previous php.bugs (#134987) next »