puran
10/2/2003 11:19:00 AM
Hi,
Currently i'm working on developing a component, which
will read all the incoming mails of an smtp server and it
has to decode the actual mail content by using the
encoded content of the mail. I also have the charset used
in encoding the mail.
For eg:
======
If the incoming mail has korean charset as "ks_c_5601-
1987" and encoded string as follows:
----------------------------------------------------------
-------------------------------
³â01¿ù28ÀÏ°æ ¸¶Áö¸·À¸·Î Á¢¼ÓÇÑ°Í °°À½
Á¢¼ÓÇßÀ» °æ¿ì $¼¹ö¿¡ ¿¬°áÇÏ°í ÀÖÀ½$À̶ó°í
The actual message is as follows:
---------------------------------
أ년01월28일경 마지막으로 접속한것 같음
접속했을 경우 $서버에 연결하고 있음$이라고
I've tried to decode the encoded content to get the
korean text using following code:
string rfc1522EncodedString = "³â01¿ù28ÀÏ°
æ ¸¶Áö¸·À¸·Î Á¢¼ÓÇÑ°Í °°À½Á¢¼ÓÇßÀ» °æ¿ì $¼¹ö¿¡ ¿¬°áÇÏ°í
ÀÖÀ½$À̶ó°í";
Encoding rfc1522Encoding =
Encoding.GetEncoding("iso-8859-1");
Encoding koreanEncoding =
Encoding.GetEncoding("ks_c_5601-1987");
byte[] rfc1522EncodingBytes =
rfc1522Encoding.GetBytes(rfc1522EncodedString);
byte[] koreanEncodingBytes =
Encoding.Convert(rfc1522Encoding, koreanEncoding,
rfc1522EncodingBytes);
string decodedString =
koreanEncoding.GetString(koreanEncodingBytes);
Can anyone give me few pointers in fixing this.
Thanks in advance
Puri