开发者

Is it possible to show data of different encodings in the same page?

I have two tables here - one is in UTF and holds Arabic text as it can be read. The other one has a different encoding however and the content is Arabic however in the database its displayed as

ÈöÓúãö Çááøåö Ç开发者_JAVA百科áÑøóÍúãóäö ÇáÑøóÍöíãö

I have to show data from both tables on the same page - the page is UTF encoded however I'm not sure if this can be done or if its possible. What do i do? My database is mysql and I'm using php.

Is it possible to convert the encoding of the contents of the other table into UTF8 btw?


You have to use mb_convert_encoding() first, on everything, to make sure it's all in UTF-8 to begin with. http://us3.php.net/manual/en/function.mb-convert-encoding.php Then it should display, assuming your HTML's charset is UTF-8 and the users have the appropriate fonts installed.

Also, virtually all consoles and a great many free online SQL commanders (like PHPMyAdmin) are not UTF-8 aware and print out jibberish. I have not yet found a free SSH client that supports UTF-8; if it's a big deal, invest in SecureCRT.


EDIT: Excuse me. I don't read Arabic at all, but I did get Arabic back. please tell me if this is the correct text, and if so, accept this answer ;_)

ب?س?ك? افف?م? افر??ح?ك?ل? افر??ح?ٍك?

The code I used to get this was: header('Content-Type: text/html;charset=utf-8'); echo mb_convert_encoding('ÈöÓúãö Çááøåö ÇáÑøóÍúãóäö ÇáÑøóÍöíãö', 'utf-8', 'iso-8859-6');

I found the Arabic encoding via this page: http://a4esl.org/c/charset.html

Cheers!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜