duanmorong9597 2011-07-06 15:27 采纳率: 100%
浏览 51
已采纳

使用PHP和MySQL进行希伯来语编码

I'm currently writing a php5 web application. It suppose to extract data from the DB and show it in an HTML page. In order to show Hebrew characters, the charset encoding in the HTML is:charset=windows-1255
The application is configured to work with MySQL. I have problems with the Hebrew encoding, it's actually some kind of paradox...
1. When I configure the collation in the DB table to be UTF_bin and the charset UTF-8:
The Hebrew characters that extracted from the db are shown fine, the HTML Hebrew not.
2. When I configure the collation in the DB table to be UTF_bin and the charset windows-1255:
The Hebrew characters that extracted from the db are show are show as random characters, the HTML Hebrew is ok.

Does anyone has an idea how to solve it?
Thanks!

  • 写回答

1条回答 默认 最新

  • douke3442 2011-07-06 16:20
    关注

    Do you have a simple coding sample/example?

    I assume you've..

    1) appended the charset on the end of the HTTP Content-Type header too? header('Content-type: text/xhtml; charset=windows-1255'); as well as the tag?

    2) using multi byte string functions http://php.net/manual/en/book.mbstring.php or are overloading all string functions http://www.php.net/manual/en/mbstring.overload.php, and/or hebrev() or hebrevc() where required

    3) and you're using setlocale() for other localisations http://php.net/manual/en/function.setlocale.php

    If you're pulling UTF out of the DB, you may need to use iconv() or similar to translate it to another encoding? http://www.php.net/manual/en/function.iconv.php

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 安装svn网络有问题怎么办
  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥15 latex怎么处理论文引理引用参考文献