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

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

问题描述

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



某些网页部分是静态的,而其他部分是动态的数据来自Sybase数据库),数据库的语言编码确定,数据显示在其中。



我的网页有一些动态的下拉列表,他们以非常英文或阿拉伯语的奇怪格式显示数据,如正方形和未知符号。



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




  • 更改PHP脚本的编码:



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


  • 更改HTML编码声明:

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


  • 更改PHP编码声明:

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


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

      Arial(阿拉伯语)。 




问题依然存在,我不知道我可以做些什么来解决这个问题。



你可以提出任何解决方案吗?

解决方案>

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



从您使用ODBC连接的注释:PHP / ODBC和UTF8似乎有问题。此线程中提到了一些建议: Php / ODBC编码问题


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

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:-

  • Changing the encoding of the PHP script:

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

  • 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" />
    

  • 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?

解决方案

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

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天全站免登陆