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

How to set mssql to utf8 in php

藏色散人
Release: 2023-03-10 07:54:01
Original
2797 people have browsed it

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.

How to set mssql to utf8 in php

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!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template