|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27324 MSSQL CLI encoding Problem
Submitted: 2004-02-19 19:07 UTC Modified: 2004-02-20 01:05 UTC
From: markus dot amsler at oribi dot org Assigned:
Status: Not a bug Package: MSSQL related
PHP Version: 4.3.4 OS: Windows
Private report: No CVE-ID: None
 [2004-02-19 19:07 UTC] markus dot amsler at oribi dot org
I couldn't insert special characters like ?????? into a MSSQL-Server.

After some investigation I found the problem happens only if php gets called from CLI and if the SQL-Client Tools are installed on the client.

The Problem was the Automatic ANSI to OEM conversion which per default is selected if the SQL-Client Tools are installed. After I disabled it in the SQL Server Client Configuration -> DB Library Options, the characters got inserted correctly.

I found this note on
that explains, why it's only happening in the Console:

"Any clients running Windows NT or Windows 95/98 are considered ANSI clients. Console-based applications, such as the isql utility, are considered OEM clients."

I'm not sure wether this behavior is a bug or a feature. Perhaps the mssql module could disable the Automatic conversion, so it would work out of the box on the console.

It's related with this one (but not exactly the same)

Reproduce code:
mssql_connect ("", "sa");
mssql_select_db ("umlaute");

$sq = "CREATE TABLE umlaute (id INT IDENTITY, value VARCHAR(255))";
mssql_query ($sq);

$sq = "INSERT INTO umlaute (value) VALUES ('??????')";
mssql_query ($sq);

Expected result:
?????? in the database umlaute table umlaute

Actual result:
field value contains  ??????


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-02-20 00:48 UTC]

 [2004-02-20 01:05 UTC]
Theis has nothing to do with PHP. It's a feature in the library used to create the MSSQL Extension.

You can use a wrapper (php_win.exe) for php.exe (the C LI version) too launch it as an ANSI application.

PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Jul 11 14:01:26 2020 UTC