Revision: 7376
http://mahogany.svn.sourceforge.net/mahogany/?rev=7376&view=rev
Author: vadz
Date: 2007-09-11 17:40:26 -0700 (Tue, 11 Sep 2007)
Log Message:
-----------
don't encode headers in an encoding which can't be used to represent their
contents
Modified Paths:
--------------
trunk/M/src/mail/MimeDecode.cpp
Modified: trunk/M/src/mail/MimeDecode.cpp
===================================================================
--- trunk/M/src/mail/MimeDecode.cpp 2007-09-11 23:50:57 UTC (rev 7375)
+++ trunk/M/src/mail/MimeDecode.cpp 2007-09-12 00:40:26 UTC (rev 7376)
@@ -603,10 +603,20 @@
if ( !NeedsEncoding(in) )
return in.ToAscii();
- // get the encoding in RFC 2047 sense: choose the most reasonable one
+ // decide about the encoding to use if none specified
if ( enc == wxFONTENCODING_SYSTEM )
+ {
+ // try to use the user current encoding first
enc = wxLocale::GetSystemEncoding();
+ }
+ if ( wxCSConv(enc).FromWChar(NULL, 0, in.wc_str()) == wxCONV_FAILED )
+ {
+ // but if we can't encode with it, fall back to UTF-8 as it never fails
+ enc = wxFONTENCODING_UTF8;
+ }
+
+ // get the encoding in RFC 2047 sense
MIME::Encoding enc2047 = MIME::GetEncodingForFontEncoding(enc);
if ( enc2047 == MIME::Encoding_Unknown )
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates