#27416 [Opn->Bgs]: Accents not supported by mssql functions
| From: | fmk@php.net | Date: | Fri, 27 Feb 2004 23:27:38 +0000 |
| Subject: | #27416 [Opn->Bgs]: Accents not supported by mssql functions | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-55671@lists.php.net to get a copy of this message | ||
ID: 27416
Updated by: fmk@php.net
Reported By: mooseyproductions at hotmail dot com
-Status: Open
+Status: Bogus
Bug Type: MSSQL related
Operating System: Windows 2000/XP
PHP Version: 4.3.4
New Comment:
You need to use the same codepage to insert and fetch the data. When
you insert data as binary values there is no codepage involved in the
process but when you select the data it uses the OEM to ANSI convertion
defined by the client library.
Previous Comments:
------------------------------------------------------------------------
[2004-02-27 10:22:38] mooseyproductions at hotmail dot com
I have tried connecting to the SQL Server database using ODBC and it
retrieves the data perfectly, as expected. I think I will use the ODBC
functions for the meanwhile, until this bug is sorted.
------------------------------------------------------------------------
[2004-02-27 09:03:03] mooseyproductions at hotmail dot com
Description:
------------
When reading data from a SQL Server database, certain ASCII characters
are incorrectly retrieved. Entering accented characters into the
database works fine, however reading them from the database gives
unexpected results.
ASCII chars 33 - 255 entered into database:
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
(This appears fine when looking at the database using MS Enterprise
Manager)
Result from read query:
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~__'".ÅÎ^%So_zYÿ½Ï¾Ýõù¸¦®ªð©îøñýüïæôú÷û§¯¬«ó¨·µ¶ÇÔÒÓÞÖ×ØÑ¥ãàâåëéêíèá
ơФ¢äö£ìç
It appears that characters after ASCII #127 are incorrectly returned
from the database.
Using SQL Server 7.0 (ISO 8859-1 charset)
Reproduce code:
---------------
$string = '';
for ($i = 33; $i <= 255; $i++)
{
$string .= chr($i);
}
$db->query("UPDATE Test SET charset = 0x".bin2hex($string)." WHERE
rowID = 1");
$result = $db->query("SELECT charset FROM Test WHERE rowID = 1");
$row = $db->getAssoc($result);
echo $row['charset'];
Expected result:
----------------
I expected to see what I had previously entered into the database. All
text that contains accents is wrongly displayed.
Expected:
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
Actual result:
--------------
Actual:
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~__'".ÅÎ^%So_zYÿ½Ï¾Ýõù¸¦®ªð©îøñýüïæôú÷û§¯¬«ó¨·µ¶ÇÔÒÓÞÖ×ØÑ¥ãàâåëéêíèá
ơФ¢äö£ìç
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=27416&edit=1