From:             www dot php dot net at landrovez dot com
Operating system: Fedora Core 6, Kernel: 2.6.20
PHP version:      5.2.3
PHP Bug Type:     MSSQL related
Bug description:  Mixed up characters in UTF-8 database with Hebrew via FreeTDS

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 bug report at http://bugs.php.net/?id=41736&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=41736&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=41736&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=41736&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=41736&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=41736&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=41736&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=41736&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=41736&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=41736&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=41736&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=41736&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=41736&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=41736&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=41736&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=41736&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=41736&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=41736&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=41736&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=41736&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=41736&r=mysqlcfg

Reply via email to