开发者

HTML source code doesn't understand Arabic text?

开发者 https://www.devze.com 2023-04-08 10:07 出处:网络
I\'m trying to read a source code for a webPage that contains Arabic text but all what am getting is this جامعة (which is not Arabic, only a group of

I'm trying to read a source code for a webPage that contains Arabic text but all what am getting is this جامعة (which is not Arabic, only a group of characters).

If I reload the page on my localhost I get the Arabic tags and text correctly. But I really need to read开发者_如何学运维 that source code. any suggestions or lines of code I can add?

<html dir=rtl>

<META http-equiv=Content-Type content=text/html;charset=windows-1256>

These are few lines from that include the "encoding" used! The page is written using HTML and PHP


The characters are merely escaped to HTML entities. The browser decodes them to "real characters" when it renders the page. You can decode them yourself using html_entity_decode:

html_entity_decode('&#1580;&#1575;&#1605;&#1593;&#1577;', ENT_COMPAT, 'UTF-8')

Note the last parameter, which sets the encoding the characters will be decoded to. Use whatever encoding you're working with internally, I'm just suggesting UTF-8 here.

0

精彩评论

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