php method to set mssql to utf8: 1. Directly modify "mssql.charset to mssql.charset = "UTF-8""; 2. Pass "ini_set('mssql.charset', 'UTF-8" ');"Set utf8.
The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer
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 PHP to obtain The specific manifestation of garbled characters 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.
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to set mssql to utf8 in php. For more information, please follow other related articles on the PHP Chinese website!