Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

#18169 [Ana->NoF]: Driver cannot deliver UCS-2 unicode to SQL Server

303 views
Skip to first unread message

il...@php.net

unread,
Jun 29, 2003, 10:33:04 PM6/29/03
to
ID: 18169
Updated by: il...@php.net
Reported By: joesterg at hotmail dot com
-Status: Analyzed
+Status: No Feedback
Bug Type: MSSQL related
Operating System: Windows 2000 Server
PHP Version: 4.1.2
New Comment:

Please try using this CVS snapshot:

http://snaps.php.net/php4-STABLE-latest.tar.gz

For Windows:

http://snaps.php.net/win32/php4-win32-STABLE-latest.zip


Previous Comments:
------------------------------------------------------------------------

[2002-12-18 18:18:47] fvu at wanadoo dot nl

If you're using PHP on a Windows platform you can use the PHP COM
extension to communicate with SQL Server via ADO. The PHP COM
extension is capable of translating UTF-8 to UCS-2 and back if you
specify so as the third parameter:

$oDb = new COM('ADODB.Connection', NULL, CP_UTF8);

This way you can use Unicode UTF-8 within PHP and Unicode UCS-2 within
SQL Server with all the translations done for you automatically.

HTH, Freddy Vulto

------------------------------------------------------------------------

[2002-07-06 07:08:48] joesterg at hotmail dot com

Thanks Marko

-I guess this means that if you are to use binary (ie. unicode) data,
then COM/ADO is your only option, if SQL Server is the database of your
choice.

From yohgaki's answer, I guess also the multibyte encoding
functionality lacks proper Unicode support -am I correct in assuming
that we will have to move to PHP4.2.x and do our own encoding/decoding
through the Win32 API then?

------------------------------------------------------------------------

[2002-07-05 05:34:22] mark...@php.net

PHP's mssql extension uses the Microsoft SQL Server's C
API, the "DB-Library for C". Specifically, SQL queries are
sent to the server using the dbcmd() function. This
function is not binary safe, so inserting UCS2 text or
images or any binary data is likely to fail.

The DB-Library for C has separate, binary-safe APIs for
entering text and images, but they are complicated and
difficult to seamlessly integrate to the current mssql
extension. Look up the documentation for dbwritetext() if
you feel like implementing this change.

UTF-8 and UTF-7 are, IIRC, the only Unicode encoding that
are guaranteed not to include null characters. They are,
therefore, the only encodings that can be reliably used
with PHP's mssql extension at this time.

------------------------------------------------------------------------

[2002-07-05 04:21:52] joesterg at hotmail dot com

You are probably right. However, Unicode is central to making
world-wide web applications, and all major database vendors have this
posibility.
I find it to be a hindrance to wider deployment of large-scale,
worldwide php applications.

Does anyone know if it is only the MSSQL module? -are there any plans
to look into this issue?

What are the future directions for PHP and Unicode support?

------------------------------------------------------------------------

[2002-07-05 04:14:38] yoh...@php.net

Wide char encoding, UCS2/UCS4/UTF16/UTF32, don't work well with current
PHP. I guess SQL Server module is using strlen() or like, that cannot
be used with wide char...

Fixing this is not simple at all.


------------------------------------------------------------------------

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/18169

--
Edit this bug report at http://bugs.php.net/?id=18169&edit=1

0 new messages