I have a string that I receive from email via C# and I want to display it in a correct format. I know the encoding in coming in as Encoding.Default
, According to this answer I have to convert it to utf8, So I tried this code:
byte[] bytes = Encoding.Default.GetBytes(input);
string strResult = Encoding.UTF8.GetString(bytes);
It works, but it can't convert some characters:
Actually in web mail interface Original string is:
باسلام همکار گرامی شماره 53018 مربوط به دبیرخانه ستاد می باشد لطفا اصلاح فرمائید
When I convert the string with the code I give this result:
باس �?ا�? �?�?�?ار گرا�?�? �?ا�?�? ش�?ار�? 53018 �?رب�?ط ب�? د ب�?رخا�?�? ستاد �?�? باشد �?طفا اص�?اح فر�?ائ�?د�?
Any idea?
Update:
PS: The content of the input variable:
Ø§ÙØ²Ø§ÙØ´ تسÙÙÙØ§Øª \r\n \r\n\r\n باس ÙØ§Ù ÙÙÙØ§Ø± گراÙÙ ÙØ§ÙÙ Ø´ÙØ§Ø±Ù