javascript - Arabic text not display but charactere المملك

I want to display arabic text but charactere المملك display.For example the word المملكة العربية

I want to display arabic text but charactere المملك display.

For example the word المملكة العربية السعودية display on المملكة العربية السعودية

I add on my page always encoded on UTF-8:

 <meta charset="utf-8">

but that not changed.

Have you a idea about that?

Thank you.

I want to display arabic text but charactere المملك display.

For example the word المملكة العربية السعودية display on المملكة العربية السعودية

I add on my page always encoded on UTF-8:

 <meta charset="utf-8">

but that not changed.

Have you a idea about that?

Thank you.

Share Improve this question asked Aug 29, 2014 at 8:21 lebossejameslebossejames 311 silver badge8 bronze badges 3
  • How is your html file saved/what is real encoding of supplied string? – Justinas Commented Aug 29, 2014 at 8:24
  • Does your puter has fonts of arabic text ? – Fumu 7 Commented Aug 29, 2014 at 8:27
  • try this stackoverflow./a/76260449/10079059 – Ali Commented May 16, 2023 at 7:40
Add a ment  | 

2 Answers 2

Reset to default 3

well, I faced this issue before. I fixed it by converting the types of encoding. first: does your text es from Data Base? or its inside your page like HTML tags?

if your text es from Database please use this:

System.IO.MemoryStream stream = new System.IO.MemoryStream();
System.IO.StreamWriter writer = new System.IO.StreamWriter(stream, System.Text.Encoding.GetEncoding("WIndows-1252"));
writer.Write("**#your text from database#**");
writer.Flush();
stream.Position = 0;
System.IO.StreamReader xx = new System.IO.StreamReader(stream, System.Text.Encoding.UTF8);
string converted = xx.ReadToEnd();

and if your text inside your page:

just do save as and select UTF-8 encoding

thanks

Load the text file in a text editor that allows character encoding to be defined, change the character encoding to UTF-8 or unicode and save the file again.

This will pre-prend magic bytes to the file, like 0xFEFF and the browser will load it accordingly.

This is an excellent explanation: UTF-8 vs. Unicode

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745351094a4623836.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信