Character Set issue using SQL Server and ODBC in p

2019-09-07 09:47发布

I connected to to sqlsever2008 with odbc(with dsn) and php but problem is that when I retrieve information from that it has character like ���������. My datatype in sqlserver is nvarchar. Any idea why it is happening?

NOTE: The page is utf8.

Edit:

I use echo utf8_encode(odbc_result($this->result,'name') ); and characters are like:

ÂãæÒÔ ÒÈÇäÂãæÒ 

i retrieve information like this:

odbc_result($this->result,'name')

3条回答
地球回转人心会变
2楼-- · 2019-09-07 10:16

Try to use utf8_decode() or utf8_encode().

查看更多
小情绪 Triste *
3楼-- · 2019-09-07 10:17

It seems, the code page your sql server has been installed is different with your native language. perhaps you need to reinstall the sql server with correct code page.

查看更多
Summer. ? 凉城
4楼-- · 2019-09-07 10:19

i found the problem.

iconv("Windows-1256", "UTF-8", "$temp")
查看更多
登录 后发表回答