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
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?
Th开发者_运维百科anks!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
精彩评论