logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

Mail-Box support for UNICODE / Perl 5.6.x: msg#00001

Subject: Mail-Box support for UNICODE / Perl 5.6.x
I'm using the Mail-Box modules to populate a PostgreSQL backed email
archive. Since PG supports UNICODE, I'm trying to ensure that the
headers & and any text based body parts are converted into UTF-8 before 
insertion.

Dealing with headers was easy enough by calling the 'study' method
on the Field object. Since I'm using perl 5.6.x though I had to make
one small patch to Mail::Message::Field::Attribute. Instead of doing

  use 5.007003
  use Encode;

I changed it to:

  if ($] < 5.007) {
    eval use Encode::compat;
  }
  use Encode;

This lets me try & load in the Encode compatability classes on
perl prior to 5.7. I'm not sure if there's any particular reason
you needed the 5.7.3 release in particular, so maybe removing
the 'use 5.0007003' was over zealous, but in my simple tests this
seems to work soo far.

I am however stuck as to decoding the text body parts. There doesn't
seem to be an equivalent to 'study' on the Mail::Message::Body::Lines
object. Am I missing something ? If there isn't an existing API i'll
just try and do the conversion manually using the 'charset' from the
MIME headers.

Are there any other areas in these modules which are known to have
significant UTF-8 issues? 

Dan.
-- 
|=-               http://www.berrange.com/~dan/gpgkey.txt             -=|
|=-   berrange@xxxxxxxxxx  -  Daniel Berrange  -  dan@xxxxxxxxxxxx    -=|

Attachment: pgp1wP7PJWF7V.pgp
Description: PGP signature

<Prev in Thread] Current Thread [Next in Thread>