Microsoft SQL Server PHP MSSQL Server encountered a problem with Chinese encoding

Source: Internet
Author: User
Tags mssql mssql server
However, after SQL Server 2005, found that its Chinese encoding only supports GB and UCS-2 (Unicode 16), so directly in the database query display is correct, but the use of PHP UTF9 encoding display is full of garbled.
Find a lot of information, what to use Mssql,freetds,odbc,ado or direct each query and write to transcode and other suggestions have. However, in the actual test, it is easy to find the method of ADO.
The code is as follows:

Copy the Code code as follows:




Copy the Code code as follows:







Print ("The next line generates an error.
");
Printaline ("please?");
Print ("This is not being displayed due to the above error.");
?>
$conn = Odbc_pconnect ("Myodbc", "sa", "Cvttdev", 0);
$c Access Driver (*.mdb);D bq= ". Realpath (" Mydb.mdb ");
$c Server}; server={192.168.22.40};D atabase=sugarcrm_db; Uid=sa; pwd=123456; ";
$C);
$query =odbc_do ($connid, "Select Id,name from Accounts");
?>













while (Odbc_fetch_row ($query)) {echo ' '; $name = Odbc_result ($query, 2); $id =odbc_result ($query, 1); Echo ' '; Echo ' '; Echo ' '; }?>
ID Title
'. $id. ''. $name. '


Query Result:

ID Title
114b0775-d9b2-db90-fcda-4a2f2cd7cdbd Future Business 629487, Ltd.
1d270085-a588-9ea7-584c-4a2f2c8d1a5b Fabriquéinterationål 79436
23
36ea2575-fe34-61b0-e5ae-4a2f2c791d22 Berufskolleg dealt Elektrotechnik 65790
3834261a-fd48-9d4a-be40-4a2f2c5fc256 Berufskolleg dealt Elektrotechnik 529523
52c9652c-82c8-ec2b-72ae-4a2f2c3a58d6 Future Business 42138, Ltd.
78931a0e-f582-f406-8a56-4a2f2c3741b0 Butée Torique 700010
989473f7-6b7b-fed3-12a1-4a2f2c320645 a.b.ケアブレイン?181212
B4579151-55cb-5ae4-a5f1-4a2f2c173b18 Bünde-mitte 203765
d72c42c9-9e1d-b926-d931-4a2f2c2a3100 Berufskolleg dealt Elektrotechnik 27682
E97002f1-035f-91d3-4592-4a2f2f780e01 Zhh

Because ODBC also has no place to set the inside code page.

The above describes the Microsoft SQL Server PHP MSSQL server encountered in the Chinese encoding problem, including the Microsoft SQL Server content, I want to be interested in PHP tutorial friends helpful.

  • 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.