开发者

why MSSQL SERVER return question marks, when I execute query in PHP?

开发者 https://www.devze.com 2023-04-10 06:14 出处:网络
My Databese server is MSSQL SERVER and I connect to it with PHP\'s PDO class, connection is successful but when I execute query I receive question marks for all text type fields.

My Databese server is MSSQL SERVER and I connect to it with PHP's PDO class, connection is successful but when I execute query I receive question marks for all text type fields.

I have "UTF-8" in HTML Charset, My database collation is "Latin1_General_BIN" and fields type is nvarchar(50).

If you have some solition for this p开发者_StackOverflow社区roblem, please reply.


I serched around and found a post on php.net.

Maybe this can help (from http://php.net/manual/en/book.pdo.php#98659 )

This works to get UTF8 data from MSSQL:

<?php
$db = new PDO('dblib:host=your_hostname;dbname=your_db;charset=UTF-8', $user, $pass);
?>

You can try using different charset arguments to see if any works.

0

精彩评论

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