PHP 和 ODBC(Sybase) 中的阿拉伯语言编码问题

发布于 2024-09-29 21:46:44 字数 493 浏览 2 评论 0原文

我是一名 PHP 开发人员,最近我使用 PHP 开发了一个网站,并使用 ODBC 连接到 Syabse 数据库。

我的数据库连接正常,我可以在网页中显示数据,但是当显示阿拉伯语数据时我遇到问题,因为它被视为正方形并且不理解符号。

我无法更改数据库语言编码,它是正确的,因为其他一些阿拉伯语数据显示良好。

我尝试了该网页中使用的相同配置,但它也不起作用。

我阅读了许多相关问题,尝试了一些解决方案,阅读了有关 UTF-8、ISO、Windows 和 Unicode 语言编码的内容,并尝试更改 HTML 元标记以显示阿拉伯语单词,但问题并未解决。

我认为我的PHP文件语言编码本身可能有问题。 我可以更改 PHP 文件语言编码吗?如果可能的话该怎么做?

有什么解决方案可以在 PHP 网页中很好地显示来自数据库的阿拉伯语吗?这是一个无聊的问题:(

我将不胜感激任何解决该问题的提示或建议,但请提及您的参考资料并提供示例(如果有)。

提前致谢...

I am a PHP Developer and Recently I develop a web site using PHP and I connect to a Syabse Database using ODBC.

My database connection is ok and I can display the data in my web pages but I face a problem when arabic data is displayed as it is viewed as squares and not understanding symbols.

I can not change the Database language encoding and it is correct as some other arabic data is displayed well.

I tried the same configuration used in that web page but it does not work too.

I read many realted problems and I tried some solutions and I read about UTF-8, ISO, Windows and Unicode langauge Encodings and I tried to change the HTML Meta tag to display the arabic words but the problem is not solved.

I think my PHP file language Encoding itself may have a problem.
Can I change the PHP file language Encoding ? How to do that if it is possible ?

Is there any solution to dispaly Arabic coming from Database well in PHP web pages ? It is a boring problem :(

I will appreciate any hint or suggestion to solve that problem but please mention your reference and put and example if it is available.

Thanks in Advance...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

听闻余生 2024-10-06 21:46:44

仅更改元标记是不够的。

假设您要将环境更改为 UTF-8,则需要确保以下内容是 UTF-8 编码的:

  • 数据库表
  • 数据库连接。
  • 页面的编码(在 Meta 标记中,或者最好是在 content-type 标头中)

与 PHP 文件的编码无关,除非它本身包含非 ASCII 内容。在这种情况下,您还需要调整其编码,通常是在 IDE 的“另存为”对话框中。

Just changing the Meta tag isn't enough.

Assuming you want to change your environment to UTF-8, you need to make sure that the following is UTF-8 encoded:

  • The database tables
  • The database connection.
  • The page's encoding (in the Meta tag, or preferably the content-type header)

the PHP file's encoding is irrelevant, unless it contains non-ASCII content itself. In that case, you need to adjust its encoding as well, usually in your IDE's "Save as" dialog.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文