Reputation: 77
When I tried to download arabic files from mvc project, I found the arabic data is changed to special characters like this تاريخ الشكوى
That's my code that I use in download:
System.Web.Mvc.FileStreamResult FSR = new FileStreamResult(stream, "application/msword");
FSR.FileDownloadName = CorrespondenceselectedFile.FileName;
return FSR;
Upvotes: 1
Views: 89
Reputation: 59650
It seems like the text "تاريخ الشكوى" ("Date of the complaint") is decoded with the default encoding instead of UTF-8.
You should probably correct the encoding somewhere in your code (not part of the shown code) or do it manually (not preferred):
string ascii = "تاريخ الشكوى";
var bytes = Encoding.Default.GetBytes(ascii);
string utf8 = Encoding.UTF8.GetString(bytes);
// utf = تاريخ الشكوى
Upvotes: 2