PHP MSSQL Chinese various garbled

Source: Internet
Author: User

1 garbled (SELECT) when querying output

Because the MSSQL database is generally GBK encoded, the PHP page is added

Header (' content-type:text/html; CHARSET=GBK ');

You can also use the following statement to view: Then set the character set by the corresponding table.

SELECT  Collationproperty ('chinese_prc_90_ci_ai'CodePage '

The return value corresponds to the table:

936 Simplified Chinese GBK
950 Traditional Chinese BIG5
437 US/Canada English
932 Japanese
949 Korean
866 Russian
65001 Unicode UFT-8

2 garbled (insert) when inserting

garbled when inserting, conversion of character set for SQL statement of query

$insert = "INSERT into Peple (name,sex) VALUES (N ' handsome ', ' male ')";
$insert
iconv$insert);

3 Updates (update)

As above, convert the character set to the update SQL statement.

PHP MSSQL Chinese various garbled

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.