Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Arabic text shows strange characters Ø§Ù„ÙØ¨Ø§Ù‰ انگليسى ØŒ

I have Arabic text (.sql pure text). When I view it in any document, it shows like this:

حر٠اول Ø§Ù„ÙØ¨Ø§Ù‰ انگليسى ØŒ حر٠اضاÙÙ‡ مثبت

But when I use an HTML document with <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>, it shows properly like this:

حرف اول الفباى انگليسى ، حرف اضافه مثبت

How can I convert it to readable text?

like image 478
barnamah Avatar asked Oct 12 '25 04:10

barnamah


1 Answers

The Arabic text has been encoded to bytes using UTF-8.

You are explicitly telling the HTML document that the bytes are encoded in UTF-8, which is why any HTML viewer will be able to display the text correctly.

However, any other text viewer will not know the bytes are encoded in UTF-8, unless you put a UTF-8 BOM in front of the text, and the viewer supports BOMs. Otherwise, as you are seeing, a text viewer may instead interpret the bytes in Latin-1 or similar encoding instead. So, you would have to manually tell the text viewer to interpret the bytes as UTF-8 instead. But how you actually do that depends on the particular text viewer you are using. Not all viewers offer this option.

like image 79
Remy Lebeau Avatar answered Oct 16 '25 07:10

Remy Lebeau



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!