Mssql reads and extracts data, and garbled characters are displayed on the webpage! I directly connect mssql_connect to ms SQL data in php. to query data, as long as you use the mssql provided by php, the read data encoding format must be gbk, this is because mssql only supports gbk encoding and cannot be defined.
While ($ row = mssql_fetch_row ($ result )){
Echo iconv ('gb2312', 'utf-8', $ row [0]);
}
Why is the output garbled ?????
You cannot use set names.
Reply to discussion (solution)
You
$ Row = mssql_fetch_row ($ result );
Echo base64_encode (serialize ($ row ));
Post result
Operator =
Array ([0] => ?? Isn t? 1 ?? [1] => continued exhibition [2] => 2012-11-19 [3] => 1 [4] =>)
What is the content of the field corresponding to $ row [0] in mssql manager?
Make sure that the webpage encoding and meta encoding and database character encoding are correct.
Array ([0] => ?? Isn t? 1 ?? [1] => continued exhibition [2] => 2012-11-19 [3] => 1 [4] =>)
What is the content of the field corresponding to $ row [0] in mssql manager?
The data you have converted is correct. how can the array 0 be garbled? also, mysql is utf8. I have converted it like this.
$ FZTDM = iconv ('gb2312', 'utf-8', $ mssql_row ['ftmid ']);
The database is also inserted with garbled characters: {j é ¦ ??
You gave me the data. I just decoded and viewed it.
Element 0 is garbled when it is obtained, so you should view the original content in the mssql manager.
Only in this way can we determine the cause of garbled text
You gave me the data. I just decoded and viewed it.
Element 0 is garbled when it is obtained, so you should view the original content in the mssql manager.
Only in this way can we determine the cause of garbled text
The original element content is 0x1306c910ca6aa9cd74d1_d350d5.
Is base64_decode used for decoding?
Garbled characters are involved when adding data. how can you transcode the data in vain? you need to solve the problem from the source.
Well, are you using this field as the primary key?
The value of this field has no significance for mysql.
Well, are you using this field as the primary key?
The value of this field has no significance for mysql.
How to convert the encoding of element 1 into mysql?
I cannot use mb_convert_encoding or iconv to convert and insert data. mysql uses utf8.
No conversion is required. the read-back data is gbk.
Therefore, you only need to execute mysql_query ('set names gbk') before reading and inserting them cyclically.
No conversion is required. the read-back data is gbk.
Therefore, you only need to execute mysql_query ('set names gbk') before reading and inserting them cyclically.
I also converted it before. It's strange.