I Can't Write Arabic text in the XAML file

2020-04-07 11:22发布

问题:

<TextBlock Text="المبلغ" />

when i built the project the following error happened:

any help....

回答1:

The problem is clear, you have a problem with your file encoding, If am not mistaken the word in the Text property up there is an Arabic keyword which requires Unicode encoding. Change your file encoding to Unicode, by doing the following:

Open the XAML file you have problem with, go to File > Save As

Click on the small down arrow at the save button to select the encoding

Select Unicode save and replace your old file.

This should solve your problem.



回答2:

Change the XAML file encoding to "UTF-8" , you can use Visual Studio to Save File As and then change the encoding.



回答3:

To Change the encoding try this

var pi = xmldoc.createProcessingInstruction("xml",
                                " version='1.0' encoding='UTF-8'");
xmldoc.appendChild(pi);

Check out the link below. http://msdn.microsoft.com/en-us/library/aa468560.aspx