PHP set MSSQL code to solve garbled problem Mssql_connect CharSet Utf8

Source: Internet
Author: User
Tags mssql

When using MSSQL to store data in nchar or nvarchar storage, because nchar or nvarcha does not support UCS-2 (that is, Sqlserv Er is not stored in UTF-8 format)

Results in PHP will be garbled after the specific performance: Chinese characters will become???? This

And does not provide similar mysql_query ("Set CharSet UTF8"); This method.

Solution:

1, directly modify the php.ini file, directly modify Mssql.charset to Mssql.charset = "UTF-8"

2, can also through Ini_set (' Mssql.charset ', ' UTF-8 ');

Note The UTF-8 option is case-sensitive.

PHP set MSSQL code to solve garbled problem Mssql_connect CharSet Utf8

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.