]> granicus.if.org Git - php/commitdiff
Fix #35730 Use correct character encoding with FreeTDS
authorFrank M. Kromann <fmk@php.net>
Wed, 21 Dec 2005 22:44:04 +0000 (22:44 +0000)
committerFrank M. Kromann <fmk@php.net>
Wed, 21 Dec 2005 22:44:04 +0000 (22:44 +0000)
NEWS
ext/mssql/php_mssql.c
ext/mssql/php_mssql.h
php.ini-dist
php.ini-recommended

diff --git a/NEWS b/NEWS
index 2c1507c5dfca570645907d9880805f8ec932556a..39b5b1f5620393ab8ba7b5955507ca2e34cbe763 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -26,4 +26,5 @@ PHP                                                                        NEWS
   the part of haystack before or after first occurence of needle. (Johannes)
 - Added possibility to check in which extension an internal function was
   defined using reflection API. (Johannes)
+- Fixed bug #35730 (Use correct character encoding, and allow setting it) (Frank)
 - Fixed bug #34286 (__toString() behavior is inconsistent). (Marcus)
index e9a7f064ec01d5f76d4d4d0f186f6b7200cd3273..554d834b9aef82fc25d53ee8280edf09693c0aa3 100644 (file)
@@ -141,6 +141,9 @@ PHP_INI_BEGIN()
        STD_PHP_INI_BOOLEAN("mssql.datetimeconvert",            "1",    PHP_INI_ALL,    OnUpdateBool,   datetimeconvert,                        zend_mssql_globals,             mssql_globals)
        STD_PHP_INI_BOOLEAN("mssql.secure_connection",          "0",    PHP_INI_SYSTEM, OnUpdateBool,   secure_connection,                      zend_mssql_globals,             mssql_globals)
        STD_PHP_INI_ENTRY_EX("mssql.max_procs",                         "-1",   PHP_INI_ALL,    OnUpdateLong,   max_procs,                                      zend_mssql_globals,             mssql_globals,  display_link_numbers)
+#ifdef HAVE_FREETDS
+       STD_PHP_INI_ENTRY("mssql.charset",                                      "",             PHP_INI_ALL,    OnUpdateString, charset,                                        zend_mssql_globals,             mssql_globals)
+#endif
 PHP_INI_END()
 
 /* error handler */
@@ -495,7 +498,9 @@ static void php_mssql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
 #endif
 
 #ifdef HAVE_FREETDS
-               DBSETLCHARSET(mssql.login, "ISO-8859-1");
+               if (MS_SQL_G(charset) && strlen(MS_SQL_G(charset))) {
+                       DBSETLCHARSET(mssql.login, MS_SQL_G(charset));
+               }
 #endif
 
        DBSETLAPP(mssql.login,MS_SQL_G(appname));
index 17e5d4d10e5ead89944cbbc1754f6d93782b1917..9c668ef368bca321cc6216219ea2f6bb4e2400c5 100644 (file)
@@ -158,6 +158,9 @@ ZEND_BEGIN_MODULE_GLOBALS(mssql)
        zend_bool allow_persistent;
        char *appname;
        char *server_message;
+#ifdef HAVE_FREETDS
+       char *charset;
+#endif
        long min_error_severity, min_message_severity;
        long cfg_min_error_severity, cfg_min_message_severity;
        long connect_timeout, timeout;
index eefaf9f22bf43f77bf1061c03a8036fec1d22852..426d4c30a10ca674624ace249dfe35e7e9deda72 100644 (file)
@@ -1046,6 +1046,11 @@ mssql.secure_connection = Off
 ; FreeTDS defaults to 4096
 ;mssql.max_procs = -1
 
+; Specify client character set. 
+; If empty or not set the client charset from freetds.comf is used
+; This is only used when compiled with FreeTDS
+;mssql.charset = "ISO-8859-1"
+
 [Assertion]
 ; Assert(expr); active by default.
 ;assert.active = On
index cb4d0c1938cd41303c0c1c3f7225710c84c9596a..1bc4bc3478fd4b1c82e106b54243f03dd69fed40 100644 (file)
@@ -1103,6 +1103,11 @@ mssql.secure_connection = Off
 ; FreeTDS defaults to 4096
 ;mssql.max_procs = -1
 
+; Specify client character set. 
+; If empty or not set the client charset from freetds.comf is used
+; This is only used when compiled with FreeTDS
+;mssql.charset = "ISO-8859-1"
+
 [Assertion]
 ; Assert(expr); active by default.
 ;assert.active = On