Home >Backend Development >PHP Problem >How to set mssql encoding in php
php method to set mssql encoding: 1. Open the "php.ini" file and modify the encoding to "mssql.charset = "UTF-8""; 2. Through "ini_set('mssql.charset', 'UTF-8')" method to set the encoding.
Recommended: "PHP Video Tutorial"
php Set mssql encoding to solve the garbled problem mssql_connect charset Utf8
When mssql is used to store data using nchar or nvarchar, because nchar or nvarcha does not support UCS-2 (that is, SQLServer will not store it in UTF-8 format)
will cause garbled characters to appear after PHP obtains the details. The performance is: Chinese characters will become ???? This
and there is no method similar to mysql_query("set charset utf8");.
Solution:
1. Directly modify the php.ini file and directly modify mssql.charset to mssql.charset = "UTF-8"
2. You can also pass ini_set('mssql.charset', 'UTF-8');
Note that the utf-8 option is case-sensitive.
The above is the detailed content of How to set mssql encoding in php. For more information, please follow other related articles on the PHP Chinese website!