BUG: Not works with 1251 encoding

Jan 4, 2010 at 10:24 AM

Return only ?????????? chars :(

Coordinator
Jan 4, 2010 at 4:19 PM

I want to investigate your mail.
Please send me entire mail text or copy it as reply to this post .
You can get entire body text by access Data property of Pop3Message object get by GetMessage method by Pop3Client class.

see the post to get entire body text
http://csharpmail.codeplex.com/Thread/View.aspx?ThreadId=74873

Developer
Feb 4, 2010 at 10:10 AM

The same for me, I receive messages in "windows-1257" encoding (Lithuania).

I get "?" instead of every custom symbol of my language.

For example, I get: "Labas rytas, ?iandien Rytin?se finans? rin? naujienose:...", but i should get: "Labas rytas, šiandien Rytinėse finansų rinkų naujienose:...".

Upon investigation, I spotted one bug in InternetTextMessage.ParseContentEncoding, when my mentioned "windows-1257" encoding was not parsed at all, because format in message header had spaces:

Content-Type: text/plain; charset = "windows-1257"

Fix:

// InternetTextMessage.cs

// ParseContentEncoding method

///charset=???; also may contain space: charset = ???;
m = Regex.Match(inLine, ".*charset ?= ?[\"]*(?<Value>[^\"]*)[;\n\r]", RegexOptions.IgnoreCase);

///charset=??? also may contain space: charset = ???
m = Regex.Match(inLine, ".*charset ?= ?[\"]*(?<Value>[^\"]*).*", RegexOptions.IgnoreCase);

// Note that I added " ?" to regex expressions, so now both formats "charset=windows-1257" and "charset = windows-1257" are recognized.
Developer
Feb 4, 2010 at 10:18 AM
Edited Feb 4, 2010 at 10:20 AM

Although my above post fixed error when content-encoding was not parsed correctly, I still get ? instead of special symbols. :(

If it will be helpful, I can include raw text of email, as seen from my email client:

 

Return-path: <apzvalgos@finasta.lt>
Received: from mailhub.zebra.lt ([192.168.18.101]) by ispmailbe21 (Cyrus
 v2.3.8) with LMTPA; Wed, 03 Feb 2010 11:07:02 +0200
X-Sieve: CMU Sieve 2.3
Received: from localhost (localhost [127.0.0.1]) by mailhub.zebra.lt (Postfix)
 with ESMTP id 3EA7032639 for ; Wed,  3 Feb 2010 11:07:03
 +0200 (EET)
X-Virus-Scanned: amavisd-new at zebra.lt
Received: from mailhub.zebra.lt ([127.0.0.1]) by localhost
 (ispmailfe101.internal.zebra.lt [127.0.0.1]) (amavisd-new, port 10024) with
 ESMTP id WQYMmgIlC6hu for ; Wed,  3 Feb 2010 11:07:02 +0200
 (EET)
Received: from smtp1.finasta.lt (smtp1.finasta.lt [195.43.136.51]) by
 mailhub.zebra.lt (Postfix) with ESMTP id DE4BD30AAD for ;
 Wed,  3 Feb 2010 11:07:02 +0200 (EET)
Date: Wed, 03 Feb 2010 11:07:01 +0200
To: <removed>
From: Finasta 
Reply-To: Finasta 
Subject: =?windows-1257?B?Unl0aW7rcyBmaW5hbnP4IHJpbmv4IG5hdWppZW5vcw==?=
Message-ID: <5508506f9ba50f2d830b92f2e2d34471@www.finasta.lt>
X-Priority: 3
MIME-Version: 1.0
Content-Type: multipart/alternative;
 boundary="b1_5508506f9ba50f2d830b92f2e2d34471"
X-Antivirus: avast! (VPS 100202-1, 02/02/2010), Inbound message
X-Antivirus-Status: Clean


--b1_5508506f9ba50f2d830b92f2e2d34471
Content-Type: text/plain; charset = "windows-1257"
Content-Transfer-Encoding: 8bit

Labas rytas,

ðiandien Rytinëse finansø rinkø naujienose:

<removed>


--b1_5508506f9ba50f2d830b92f2e2d34471
Content-Type: text/html; charset = "windows-1257"
Content-Transfer-Encoding: 8bit
// The same content here, only in HTML.
--b1_5508506f9ba50f2d830b92f2e2d34471--
Coordinator
May 1, 2010 at 3:28 AM

Perhaps recent update(2010/4/30) may modify this issue.
Pop3Client class always use encoding ascii in old version.
I add ResponseEncoding property to Pop3Client class.
Set this property UTF-8 and propably you may get correct  char.