PHP 从 SQL SERVER 获取阿拉伯语内容
运行 MSSQL_QUERY
时如何获取阿拉伯语内容?
它显示为 ??????
,我尝试这样做:
$res = mssql_query($q);
$row = mssql_fetch_row($res)
echo iconv("unicode", "utf-8", $row[0])
但在这种情况下,它显示的值为中文字母 潬穬
任何建议都将受到高度赞赏
How can I get Arabic content when I run MSSQL_QUERY
?
It appears as ????
, I tried to do this:
$res = mssql_query($q);
$row = mssql_fetch_row($res)
echo iconv("unicode", "utf-8", $row[0])
but in this case it shows the value as Chinese letters as 潬穬
any suggestion is highly appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
只需使用 Unicode 数据类型。 Unicode 数据类型为 nchar、nvarchar、nvarchar(max) 和 ntext,并且必须在所有 Unicode 字符串前面添加大写字母 N。
Just use Unicode data types. The Unicode data types are nchar, nvarchar, nvarchar(max), and ntext and you must precede all Unicode strings with a capital letter N.
首先尝试安装 http:/ 上找到的 sqlsrv 驱动程序/msdn.microsoft.com/en-us/library/cc793139%28v=sql.90%29.aspx。正确遵循说明后,连接到 sql server 时使用:
它应该可以正常工作
另请参阅 sqsrv 驱动程序的帮助文档以了解其他编码。
希望有帮助。
Firstly try installing the sqlsrv drivers found on http://msdn.microsoft.com/en-us/library/cc793139%28v=sql.90%29.aspx. After following the instructions correctly, when connecting to sql server use :
it should work just fine
Also see help docs of sqsrv drivers for other encodings.
Hope it helps.
好吧,在选择阿拉伯文本之前尝试将其发送到数据库:
例如,使用 PDO 时:
其次,确保所有文件(PHP 文件、HTML 模板)都使用 UTF-8 编码保存。
第三,如果这一切都失败了,请尝试更多地使用 iconv() 函数:
依此类推。
Well, try sending this to database before you select the arabic text:
For example, when using PDO:
Secondly, make sure that all your files (PHP files, HTML templates) are saved with UTF-8 encoding.
Thirdly, if all that fails, try playing with the iconv() function a bit more:
And so on.