Bug #14353: can't set CP_UTF8 codepage
| From: | msisolak at yahoo dot com | Date: | Wed, 05 Dec 2001 23:18:24 +0000 |
| Subject: | Bug #14353: can't set CP_UTF8 codepage | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-72682@lists.php.net to get a copy of this message | ||
From: msisolak@yahoo.com
Operating system: Windows 2000
PHP version: 4.1.0
PHP Bug Type: COM related
Bug description: can't set CP_UTF8 codepage
A call to create a COM object can pass the codepage as the third parameter
and CP_UTF8 is a valid option. If you use this, however, the object create
fails.
The problem is in the php_char_to_OLECHAR and php_OLECHAR_to_char functions
in com\conversion.c. MSDN states that a call to WideCharToMultiByte with a
codepage of CP_UTF8 must have a second parameter is 0, but these functions
don't account for that.
How I fixed it (there may be a better way, but it works for me):
lines 764 and 760: change "MB_PRECOMPOSED | MB_ERR_INVALID_CHARS" to
"codepage == CP_UTF8 ? 0 : MB_PRECOMPOSED | MB_ERR_INVALID_CHARS"
lines 784 and 790: change "WC_COMPOSITECHECK" to "codepage == CP_UTF8 ? 0 :
WC_COMPOSITECHECK"
This fix is not well debugged, but it got me moving forward again.
--
Edit bug report at: http://bugs.php.net/?id=14353&edit=1