Unicode Support and Endianness
Published Mar 23 2019 11:02 AM 381 Views
First published on MSDN on Aug 29, 2008

We’ve seen more activity on our MSDN Forum over the past couple weeks (yay!) and there have been a few threads about how/if the SQL Server Driver for PHP supports Unicode.  Rest assured, the SQL Server Driver for PHP does support Unicode.  The driver expects Unicode strings to be in little endian format, since that's what SQL Server uses.

When you convert strings between different encodings in PHP using iconv or mb_convert_encoding, PHP will assume big endian format if you do not specify endianness.  In other words, you must specify "ucs-2le" instead of just "ucs-2".  The example in our documentation for working with UTF-8 strings did not specify endianness so the strings were converted to and from Unicode in big endian format.  We're in the process of correcting that error and apologize for the confusion.

For more information on endianness and the origin of the term "endian", see Michael Kaplan's blog post or the Wikipedia entry on endianness .

David Sceppa

Program Manager - Microsoft SQL Server Driver for PHP

Version history
Last update:
‎Mar 23 2019 11:02 AM
Updated by: