Bug #80869 [NEW]: SQL Server: Read NVARCHAR Unicode

From: Date: Mon, 15 Mar 2021 16:25:06 +0000
Subject: Bug #80869 [NEW]: SQL Server: Read NVARCHAR Unicode
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-232739@lists.php.net to get a copy of this message
From: sergiopaternoster73 at gmail dot com Operating system: Ubuntu 18.04 Server PHP version: 8.0.3 Package: PDO ODBC Bug Type: Bug Bug description:SQL Server: Read NVARCHAR Unicode Description: ------------ I have an SQL Server 2012 table that contains all NVARCHAR columns. With PHP 7.3/7.4 I can read both ASCII and UNICODE characters from the table by running this query: SELECT CAST([NAME] AS NVARCHAR(MAX)) AS [Name] FROM [Table]. With php-8.0.3 I can still read ASCII results (plain English, for example) but not UNICODE anymore (Chinese characters, in my case). I use php-8.0.3 with FreeTDS on Linux Ubuntu. In PHP 7.3/7.4 works well! Test script: --------------- ``` $query = "SELECT CAST([NAME] AS NVARCHAR(MAX)) AS [Name] FROM [Table]"; $pdo = new PDO("odbc:MyConnection","MyUser","MyPassword"); $rs = $pdo->query($query); $result = $rs->fetchColumn(); file_put_contents("result.txt",$result); $pdo = null; ``` /etc/odbc.ini settings [MyConnection] Description = "Data Warehouse" Port = 1433 Driver = FreeTDS Description = SQL Server Trace = No Server = my.server.com Database = AB TDS_Version = 8.0 Client_Charset = UTF-8 ApplicationIntent = ReadOnly Expected result: ---------------- Readable Unicode (Chinese, in my case) characters (like it is in PHP 7) Actual result: -------------- Unreadable characters -- Edit bug report at https://bugs.php.net/bug.php?id=80869&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=80869&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=80869&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=80869&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=80869&r=needscript Try newer version: https://bugs.php.net/fix.php?id=80869&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=80869&r=support Expected behavior: https://bugs.php.net/fix.php?id=80869&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=80869&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=80869&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=80869&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=80869&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=80869&r=dst IIS Stability: https://bugs.php.net/fix.php?id=80869&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=80869&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=80869&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=80869&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=80869&r=mysqlcfg

« previous php.bugs (#232739) next »