Bug #41736 [Asn->Opn]: Mixed up characters in UTF-8 database with Hebrew via FreeTDS
| From: | kalle@php.net | Date: | Mon, 29 Dec 2014 01:04:44 +0000 |
| Subject: | Bug #41736 [Asn->Opn]: Mixed up characters in UTF-8 database with Hebrew via FreeTDS | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-189282@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=41736&edit=1
ID: 41736
Updated by: kalle@php.net
Reported by: www dot php dot net at landrovez dot com
Summary: Mixed up characters in UTF-8 database with Hebrew
via FreeTDS
-Status: Assigned
+Status: Open
Type: Bug
Package: MSSQL related
Operating System: Fedora Core 6, Kernel: 2.6.20
PHP Version: 5.2.3
-Assigned To: fmk
+Assigned To:
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2008-09-30 09:27:29] borissh at vigsm dot com
This bug isn't against PHP at all reather aginst FreeTDS see debian bug Bug#500451 .
------------------------------------------------------------------------
[2008-09-07 13:23:44] www dot php dot net at landrovez dot com
wadap?
------------------------------------------------------------------------
[2007-07-03 17:41:16] www dot php dot net at landroverz dot com
screenshot example: http://landroverz.com/pics/php5-mssql-bad-output-demo.jpg
The red color shows the jumping char.
The blue color shows the missing char.. which is gone somewhere.
------------------------------------------------------------------------
[2007-06-19 10:19:36] www dot php dot net at landrovez dot com
Description:
------------
I'm running FreeTDS version 0.64 ( latest + stable ) connecting to mssql 2000 database.
At the FreeTDS config located at: /etc/freetds.conf I've specified
tds version = 8.0
client charset = UTF-8
at the related connection, so far so good. it works.
The problem starts printing the data from the database.
When the last char of the selected array that I get from the DB query is a hebrew char it moves it
to the next position in the array for some reason.
It only happens when the last char is hebrew, if the last char is "." for example it works
just fine.
I think its something to do with UTF-8.
Reproduce code:
---------------
$mssql = mssql_connect("SQLSERVER", "root", "PASSWORD");
$mssql_db = mssql_select_db("devel_table", $mssql);
$download_id = "1";
$download_res = mssql_query("SELECT ID, Title, Description, URL FROM tblDemo WHERE Download_ID
= '$download_id'");
$download = mssql_fetch_array($download_res);
echo "<pre>"
print_r($download[Title]);
echo "</pre>";
Expected result:
----------------
Array
(
[0] => 1
[ID] => 1
[1] => THE BEST GAME IN THE WORLD
[Title] => THE BEST GAME IN THE WORLD
[2] => DOWNLOADS THIS GREAT GAME NOW
[Description] => DOWNLOADS THIS GREAT GAME NOW
[3] => http://sample.com/download.zip
[URL] => http://sample.com/download.zip
)
Actual result:
--------------
Array
(
[0] => 1
[ID] => 1
[1] => THE BEST GAME IN THE WORL
[Title] => THE BEST GAME IN THE WORL
[2] => DDOWNLOADS THIS GREAT GAME NO
[Description] => DDOWNLOADS THIS GREAT GAME NO
[3] => Whttp://sample.com/download.zip
[URL] => Whttp://sample.com/download.zip
)
*** the title should have been at hebrew for this bug to happen, for your continence the title and
description are set to English just to show the example.
As you can see it took the LAST hebrew letter from the END of the vchar and moved it to the NEXT one
by the select order.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=41736&edit=1