Home >Backend Development >PHP Problem >How to set mssql encoding in php

How to set mssql encoding in php

藏色散人
藏色散人Original
2020-09-03 10:02:461802browse

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.

How to set mssql encoding in php

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn