php.net |  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
Description:
------------
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 http://www.schemamania.org/jkl/booksonline/SQLBOL70/html/1_client_20.htm
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)
http://bugs.php.net/bug.php?id=11868



Reproduce code:
---------------
mssql_connect ("192.9.122.108", "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  ??????

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-02-20 00:48 UTC] sniper@php.net
Feature.

 [2004-02-20 01:05 UTC] fmk@php.net
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-2018 The PHP Group
All rights reserved.
Last updated: Mon Dec 17 09:01:25 2018 UTC