Mail-Box support for UNICODE / Perl 5.6.x

"Daniel P. Berrange" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.mail-box
Message-ID <[email protected]>
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             -=|
|=-   [email protected]  -  Daniel Berrange  -  [email protected]    -=|
signature.asc (application/pgp-signature, 232 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQFASKI/vTAeyOKLMk4RAniuAJ9pTcYwacI86wnJKMCjPArHYd7zYQCgzfYz
Xti9dmXWypdZWpUCrwTMAPE=
=YtH2
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.