Update of /cvsroot/mahogany/M/src/modules
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6928/src/modules

Modified Files:
        HtmlViewer.cpp 
Log Message:
fixed bug in parsing charset string (space before charset is optional)

Index: HtmlViewer.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/HtmlViewer.cpp,v
retrieving revision 1.61
retrieving revision 1.62
diff -b -u -2 -r1.61 -r1.62
--- HtmlViewer.cpp      11 Feb 2004 22:02:11 -0000      1.61
+++ HtmlViewer.cpp      27 Apr 2004 11:26:16 -0000      1.62
@@ -195,13 +195,16 @@
         if ( tag.GetParam(_T("HTTP-EQUIV")).CmpNoCase(_T("Content-Type")) == 0 )
         {
-            // strlen("text/html; charset=")
-            static const int CHARSET_STRING_LEN = 19;
+            wxString content = tag.GetParam(_T("CONTENT")).Lower(),
+                     rest;
+            if ( content.StartsWith(_T("text/html;"), &rest) )
+            {
+                // there can be some leading white space
+                rest.Trim(false /* from left */);
 
-            wxString content = tag.GetParam(_T("CONTENT"));
-            if ( content.Left(CHARSET_STRING_LEN) == _T("text/html; charset=") )
+                wxString charset;
+                if ( rest.StartsWith(_T("charset="), &charset) )
             {
-                wxFontEncoding enc =
-                    wxFontMapper::Get()->CharsetToEncoding(
-                              content.Mid(CHARSET_STRING_LEN));
+                    wxFontEncoding
+                        enc = wxFontMapper::Get()->CharsetToEncoding( charset);
 
                 if ( enc == wxFONTENCODING_SYSTEM
@@ -221,4 +224,5 @@
             }
         }
+        }
 
         return false;



-------------------------------------------------------
This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek
For a limited time only, get FREE Ground shipping on all orders of $35
or more. Hurry up and shop folks, this offer expires April 30th!
http://www.thinkgeek.com/freeshipping/?cpg=12297
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to