Thanks for your reply, CountZero.
The reason I posted an inquiry on PerlMonks before I delved into using Email::Simple is because it wasn't obvious to me from its documentation whether it could be used to edit EML files in place (effectively, at least). I needed to make small changes to many EML files, but I didn't want to have to construct whole Internet mail messages anew. And it takes me longer than it probably takes most Perl programmers to learn to use a new module.
It turns out I don't have to repair the EML files after all. But I do have to extract the character encoding damaged text from them and make a best effort to reverse the corruption. (See How to Fix Character Encoding Damaged Text Using Perl?.) I was able to determine that, in my finite collection of EML files, the damaged text is consistently in the same format, so matching the pattern was trivial using a regular expression. The script I wrote is included below.
|