1

I have eml files which I parse them by using streamreader in c#. The issue is that these eml files contain =C5=9F and =C4=B1 respectively ş and ı

I'm using the following code but I assume its not the right place to set the encoding which the producer of eml file is encoding it before I parse the produced file therefore I assume I need to replace them with the appropriate Unicode chars. fsEML is an instance of an filestream class which I created it with file.read().

StreamReader sr = new StreamReader(fsEML, System.Text.Encoding.UTF8,false);
Cem
  • 889
  • 2
  • 10
  • 22
  • sounds like you should decode the contents of the file instead, to get plain UTF-8 text back. What you're looking at now doesn't make much sense to interact with. – bzlm Jun 25 '11 at 15:14
  • It looks like your eml files use some sort of MIME encoding, you should try and decode that. – Kerrek SB Jun 25 '11 at 15:17
  • encoding of eml file is UTF8 , I just used Server.HtmlDecode and it returns the same string which is =C5=9F – Cem Jun 25 '11 at 15:29
  • the encoding isn't UTF-8 or HTML encoding. Look again. :) It seems like you already understood that =C5=9F somehow represents ş, so it sounds like you're almost there. – bzlm Jun 25 '11 at 15:34
  • thanks, so what method should I use to replace them all, I dont know how many of those is going to be in it. =C5=9F and =C4=B1 are the only one i know. – Cem Jun 25 '11 at 15:43

1 Answers1

2

This encoding is called Quoted-printable. There is some functionality in .Net to decode it, but it's not exposed nicely, see this answer.

Community
  • 1
  • 1
svick
  • 236,525
  • 50
  • 385
  • 514