开发者

SQL Server cyrillic error in php

开发者 https://www.devze.com 2023-01-27 19:08 出处:网络
First of all I want to apologize to my bad English. And now for my problem. I have a SQL Server database and I want to get data from it with php. I can execute just select queries, because the databa

First of all I want to apologize to my bad English.

And now for my problem. I have a SQL Server database and I want to get data from it with php. I can execute just select queries, because the database is not on localhost. I must get data from this database and the data is in cyrillic. This is my pro开发者_如何学Cblem. When I execute mssql_query and get data, the Cyrillic symbols are returned as ????.

I try to convert characters with iconv and mb_convert_string, but without success.

Does anybody have a similar problem and how have you solved it?


Do you have the cyrillic language pack installed on the web server and your client computer? If you can connect to the SQL Server directly you might want to just export the data from the SQL Server using the BCP command line utility.

What is the end goal that you are going for?


If the returned characters are actually question marks then you the problem may have been at the DB end with the data having been incorrectly imported. In this case there may be little you can do.

If the returned characters are just being displayed as question marks, check the actual bytes (e.g. by using bin2hex on the string) and use that to determine the encoding that you have received. You'll need to inform iconv of the correct encoding otherwise its "garbage in, garbage out".

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号