2

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.

lebossejames
  • 23
  • 1
  • 8

2 Answers2

3

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

if your text comes 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

Manos Nikolaidis
  • 21,608
  • 12
  • 74
  • 82
0

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

Community
  • 1
  • 1
pid
  • 11,472
  • 6
  • 34
  • 63
  • I edit with notepad++ and eclipse editor the character is encoded to UTF-8. – lebossejames Aug 29 '14 at 17:07
  • Good, then how exactly do you produce that text? Is it static HTML? a JS string? Downloaded through AJAX? Taken from a DB with C#, PHP, Java? Please be more specific and add code examples, because right now it's impossible to understand where the problem is. – pid Aug 29 '14 at 18:12
  • It's a static text html and javascript – lebossejames Aug 29 '14 at 20:42