peti/hsemail

Problem parsing UTF-8 characters

rul opened this issue · 2 comments

rul commented

Hello. I'm using your library to parse some emails but it get stuck when it find a non US-ASCII character. For example, take a look at the following email:

To: <jorge@one.example.com>
Subject: A Subject
Date: Mon, 19 Aug 2013 15:30:17 -0300
From: Jorge anonimo <jorge@example.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset="UTF-8"


Moodle -> Foros -> Foro de consultas de práctica -> Consulta
segundo examen de promoción

Hola queria saber que temas se incluiran en el segundo examen de promocion.

muchas gracias

Jorge

The result of parsing the email will be:

Message [OptionalField "To" " <jorge@one.example.com>",
         Subject " A Subject",
         Date (CalendarTime {ctYear = 2013, ctMonth = August, ctDay = 19, ctHour = 15, ctMin = 30, ctSec = 17, ctPicosec = 0, ctWDay = Monday, ctYDay = 0, ctTZName = "", ctTZ = -10800, ctIsDST = False}),
         From [NameAddr {nameAddr_name = Just "Jorge anonimo", nameAddr_addr = "jorge@example.com"}],
         OptionalField "MIME-Version" " 1.0",
         OptionalField "Content-Transfer-Encoding" " 8bit",
         OptionalField "Content-Type" " text/plain; charset=\"UTF-8\""]
         "\r\nMoodle -> Foros -> Foro de consultas de pr"

As you can see, the library cuts my email. Is this the expected behavior of the library? If it is, how would be a proper way of parsing this kind of emails?

Thanks in advance.

Cheers.

peti commented

This issue is fixed in version 1.7.7, which is now available on Hackage. Thank you for the bug report!

rul commented

Thanks for such a quick fix! I can confirm that this issue is now fixed.

Cheers.