如何解决我的 PHP 网页文件语言编码问题? [英] How I can solve my PHP web page file language encoding?

查看:25
本文介绍了如何解决我的 PHP 网页文件语言编码问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 PHP 语言编码有问题,因为我的 php 文件应该同时显示英文和阿拉伯字符.

I have a problem in Language Encoding in PHP as my php file should display both English and Arabic Characters.

部分网页部分是静态的,而其他部分是动态的(数据来自 Sybase 数据库),数据库的语言编码没问题,因为数据在其中显示得很好.

Some web page parts are static and others are dynamic (data comes from a Sybase database) and the language encoding of database is ok as data is displayed well in it.

我的网页有一些动态下拉列表,但它们以一种奇怪的格式显示数据,而不是像正方形和未知符号那样的英语或阿拉伯语.

My web page has some drop down lists that are dynamic but they display the data in a strange format which is not English or Arabic like squares and unknown symbols.

我检查了可能的原因并做了很多解决方案,例如:-

I checked the possible causes and did many solutions like:-

  • 更改 PHP 脚本的编码:

  • Changing the encoding of the PHP script:

使用名称:WebPage1 保存文件,类型:PHP 和编码:ANSI 或 UTF-8 或 Unicode.

Saving File with the Name : WebPage1 of Type : PHP and Encoding : ANSI or UTF-8 or Unicode.

更改 HTML 编码声明:

Changing the HTML encoding declaration:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256" />

  • 更改 PHP 编码声明:

  • Changing the PHP encoding declaration:

    header('Content-Type: text/html; charset=UTF-8);
    header('Content-Type: text/html; charset=windows-1256');
    

  • 更改数据库表格的字体和语言:

  • Changing the database tables font and language:

    Arial(Arabic).
    

  • 问题仍然存在,我不知道我能做些什么来解决这个问题.

    The problem still exists and I do not know what I can do to solve that.

    你能提出任何解决方案吗?

    Can you suggest any solution?

    推荐答案

    检查您的数据库连接,确保 sybase_connect 以 UTF-8 作为字符集连接.请参见 http://php.net/manual/en/function.sybase-connect.php

    Check your database connection, make sure the sybase_connect connects with UTF-8 as charset. See http://php.net/manual/en/function.sybase-connect.php

    从您使用 ODBC 连接的评论来看:PHP/ODBC 和 UTF8 似乎存在问题.此线程中提到了一些建议:Php/ODBC 编码问题

    From the comment that you are using ODBC to connect: There seems to be an issue with PHP/ODBC and UTF8. Some suggestions are mentioned in this thread: Php/ODBC encoding problem

    这篇关于如何解决我的 PHP 网页文件语言编码问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆