User: ihi     
Date: 2006/08/28 08:08:13

Modified:
   dba/dbaccess/source/ui/misc/HtmlReader.cxx

Log:
 INTEGRATION: CWS dba205a (1.25.12); FILE MERGED
 2006/07/31 09:12:10 oj 1.25.12.1: #i53579# set correct text encoding

File Changes:

Directory: /dba/dbaccess/source/ui/misc/
========================================

File [changed]: HtmlReader.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/misc/HtmlReader.cxx?r1=1.25&r2=1.26
Delta lines:  +19 -3
--------------------
--- HtmlReader.cxx      20 Jun 2006 03:20:01 -0000      1.25
+++ HtmlReader.cxx      28 Aug 2006 15:08:11 -0000      1.26
@@ -41,6 +41,9 @@
 #ifndef _CONNECTIVITY_DBTOOLS_HXX_
 #include <connectivity/dbtools.hxx>
 #endif
+#ifndef _TOOLS_TENCCVT_HXX
+#include <tools/tenccvt.hxx>
+#endif
 #ifndef _COMPHELPER_EXTRACT_HXX_
 #include <comphelper/extract.hxx>
 #endif
@@ -270,13 +273,15 @@
        DBG_CHKTHIS(OHTMLReader,NULL);
        if(m_bError || !m_nRows) // falls Fehler oder keine Rows mehr zur 
"Uberpr"ufung dann gleich zur"uck
                return;
-       if(!m_bMetaOptions)
-               setTextEncoding();
 
        if(m_xConnection.is())    // gibt an welcher CTOR gerufen wurde und 
damit, ob eine Tabelle erstellt werden soll
        {
                switch(nToken)
                {
+            case HTML_META:
+                if(!m_bMetaOptions)
+                           setTextEncoding();
+                break;
                        case HTML_TABLE_ON:
                                ++m_nTableCount;
                                {       // es kann auch TD oder TH sein, wenn 
es vorher kein TABLE gab
@@ -702,7 +707,18 @@
        {
                case HTML_META_CONTENT_TYPE:
                        if( aContent.Len() )
-                               SetSrcEncoding(GetEncodingByMIME( aContent ));
+            {
+                rtl_TextEncoding eEnc = GetEncodingByMIME( aContent );
+                // If the encoding is set by a META tag, it may only overwrite 
the
+                // current encoding if both, the current and the new encoding, 
are 1-BYTE
+                // encodings. Everything else cannot lead to reasonable 
results.
+                if ( rtl_isOctetTextEncoding( eEnc ) &&
+                        rtl_isOctetTextEncoding( GetSrcEncoding() ) )
+                {
+                    eEnc = GetExtendedCompatibilityTextEncoding( eEnc );
+                    SetSrcEncoding( eEnc );
+                }
+            }
                        break;
        }
 }




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to