Php connection mssql database Chinese garbled questions
Source: Internet
Author: User
Php connection mssql database Chinese garbled problem a piece of code (query mssql database) can normally output Chinese on one server, transferred to another server, query the database to retrieve Chinese garbled characters, English numbers are normal, excuse me, how can I change this to be normal ...???, Commonly used encoding is utf8-general-ci is not only the table to be unified, to unified a total of four is: Database type, php connection mssql database Chinese garbled problem
A piece of code (querying the mssql database) can normally output Chinese characters on one server and be transferred to another server. the Chinese characters obtained from the database are garbled and English numbers are normal. could you please tell me, how can this problem be changed to be normal ...???
------ Solution --------------------
Coding commonly used is utf8-general-ci
Not only tables must be unified, but a total of four tables must be unified.
First, the database types, including databases, tables, and fields, must be unified. check the fields.
Second, the file encoding type. if you use dw or editplus, you can view the page encoding.
Third, set NAMES utf8 when accessing the database;
4. add the meta attribute in the browser display mode.
No matter how GBK or GB2312 is used, the steps must be unified.
------ Solution --------------------
The local codes of the two servers are different !~~~~~ Check whether the local encoding is the same as saving it in Notepad and then checking whether the encoding is the same !~~
------ Solution --------------------
Http://blog.csdn.net/xiaowall/article/details/7864343
------ Solution --------------------
You cannot directly connect to SQL server from linux. check whether the configuration of the connection tool is appropriate.
Since one server performs normally, it is not difficult to compare the settings.
If you try to solve the problem in php, you must at least give the original string of "garbled" (remember to use base64 encoding to avoid information loss)
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.