]> git.saurik.com Git - wxWidgets.git/commitdiff
wxHtmlFilterHTML adds fake <meta> tag so that the parser knows charset
authorVáclav Slavík <vslavik@fastmail.fm>
Sun, 16 Jan 2000 22:53:25 +0000 (22:53 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sun, 16 Jan 2000 22:53:25 +0000 (22:53 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5461 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/html/htmlfilt.cpp

index 350037cea132eee40d17beb7dbb5d0d2d18f4d47..199b91c6c447543c034df30201e3da31599fbfb1 100644 (file)
@@ -130,7 +130,7 @@ bool wxHtmlFilterHTML::CanRead(const wxFSFile& file) const
 // This is true in most case but some page can return:
 // "text/html; char-encoding=...."
 // So we use Find instead
-  return (file.GetMimeType().Find(wxT("text/html")) == 0);
+  return (file.GetMimeType().Find(_("text/html")) == 0);
 }
 
 
@@ -148,7 +148,15 @@ wxString wxHtmlFilterHTML::ReadFile(const wxFSFile& file) const
     doc = src;
     delete[] src;
 
-    return doc;
+    // add meta tag if we obtained this through http:    
+    if (file.GetMimeType().Find(_T("; charset=")) == 0)
+    {
+        wxString s(_T("<meta http-equiv=\"Content-Type\" content=\""));
+        s << file.GetMimeType() <<  _T("\">");
+        return s;
+    }
+
+    else return doc;
 }