bugMHonArc - Bugs: bug #14704, HTML mail does not get its charset...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #14704: HTML mail does not get its charset converted (patch included)

Submitter:  Boris Smirnov <bsmirnov>
Submitted:  Tue 04 Oct 2005 08:45:57 AM UTC
   
 
Category:  Mail Parsing Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Behavior
Status:  Fixed Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Operating System:  All Perl Version:  5.8.7
Component Version:  2.6.15 Fixed Release:  2.6.16

Discussion locked!

Tue 20 Dec 2005 08:55:57 PM UTC, comment #3: 

Thanks for spotting my typo.  Fix has been checked into CVS.

Earl Hood <ehood>
Group administrator
Mon 10 Oct 2005 10:52:30 AM UTC, comment #2: 

oops, i forgot, that code is not allowed in comments
see comment.txt attached...

Boris Smirnov <bsmirnov>
Mon 10 Oct 2005 10:47:13 AM UTC, comment #1: 

1. look for patch in the attachment, not in the message body
2. not included in the patch, but i changed the regexp m/(<meta\s+http-equiv\s*=\s*['"]?content-type\b[^>]*>)/xi
to
m/(<meta(?:\s+[^>]*)?\s+http-equiv\s*=\s*['"]?content-type\b[^>]*>)/xi
to handle the header:
<META content="text/html; charset=koi8-r" http-equiv=Content-Type>
that is generated by
<META content="MSHTML 5.00.3831.1800" name=GENERATOR>

Boris Smirnov <bsmirnov>
Tue 04 Oct 2005 08:45:57 AM UTC, original submission:  

When text/html part of a message is being archived, and is in a charset different then charset of the archive, it is placed on a message page without charset conversion.
Example: when TextEncode is "cp1251;MHonArc::Encode::from_to;MHonArc/Encode.pm" or
"utf-8; MHonArc::UTF8::to_utf8; MHonArc/UTF8.pm", and HTML part is in koi8-r charset. The character set conversion does not happen.

Here is the fix:

--- readmail.pl.orig    2005-10-04 14:42:17.762886100 +0600
+++ readmail.pl 2005-10-04 14:43:00.701769100 +0600
@@ -1372,7 +1372,7 @@
     # If HTML, check <meta http-equiv=content-type> tag since it
     # can be different than what is specified in the entity header.
     if (($subtype eq 'html' || $subtype eq 'x-html') &&
-       ($body =~ m/(<meta\s+http-equiv\s*=\s*['"]?
+       ($$body =~ m/(<meta\s+http-equiv\s*=\s*['"]?
                     content-type\b[^>]*>)/xi)) {
        my $meta = $1;
        if ($meta =~ m/\bcharset\s*=\s*['"]?([\w\.\-]+)/i) {

Boris Smirnov <bsmirnov>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #2954:  comment.txt added by bsmirnov (388B - text/plain - file with code from the first comment)
file #2971:  patch added by bsmirnov (525B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by Beuc (Updated the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2008-12-22 Beuc Discussion LockNone Locked
    2006-06-10 ehood StatusReady For Test Fixed
        Open/ClosedOpen Closed
        Fixed ReleaseCVS 2.6.16
    2005-12-20 ehood StatusNone Ready For Test
        Fixed Release CVS
    2005-10-10 bsmirnov Attached File- Added comment.txt, #3035
    2005-10-04 bsmirnov Attached File- Added patch, #3020

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code