No subject


Fri Jan 20 20:58:57 UTC 2006


"if the first byte of the text field has a value "0x10" then the
following two bytes carry a 16-bit value (uimsbf) N to indicate that
the remaining data of the text field is coded using the character code
table specified by ISO Standard 8859, parts 1 to 9; "

--einar

p.s. I'm not the worlds greatest coder, so if somebody could have a
look at the patch and polish that up, that would be just great...

------=_Part_1596_18734929.1138750010869
Content-Type: application/octet-stream; name=iso8859.diff
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="iso8859.diff"

Index: libs/libmythtv/siparser.cpp
===================================================================
--- libs/libmythtv/siparser.cpp	(revision 8736)
+++ libs/libmythtv/siparser.cpp	(working copy)
@@ -957,7 +957,7 @@
     unsigned char buf[length];
     memcpy(buf, src, length);
 
-    if ((buf[0] < 0x10) || (buf[0] >= 0x20))
+    if ((buf[0] < 0x10) || (buf[0] >= 0x20) || (buf[0] == 0x10))
     {
         // Strip formatting characters
         for (uint p = 0; p < length; p++)
@@ -976,18 +976,30 @@
             QTextCodec *codec = QTextCodec::codecForName(coding);
             result = codec->toUnicode((const char*)buf + 1, length - 1);
         }
+	else if (buf[0] == 0x10)
+	{
+		// If the first byte of the text field has a value "0x10" then the following two bytes carry a 16-bit value (uimsbf) N
+		// to indicate that the remaining data of the text field is coded using the character code table specified by
+		// ISO Standard 8859, parts 1 to 9
+
+		uint code = 1;
+		swab(buf + 1, &code, 2);
+		QString coding = "ISO8859-" + QString::number(code);
+		QTextCodec *codec = QTextCodec::codecForName(coding);
+		result = codec->toUnicode((const char*)buf + 3, length - 3);
+	}
         else
         {
-            // Unknown/invalid encoding - assume local8Bit
+	    // Unknown/invalid encoding - assume local8Bit
             result = QString::fromLocal8Bit((const char*)buf + 1, length - 1);
         }
     }
     else
     {
-        // TODO: Handle multi-byte encodings
+	// TODO: Handle multi-byte encodings
 
-        VERBOSE(VB_SIPARSER, LOC + "Multi-byte coded text - not supported!");
-        result = "N/A";
+	 VERBOSE(VB_SIPARSER, LOC + "Multi-byte coded text - not supported!");
+    	 result = "N/A";
     }
 
     return result;


------=_Part_1596_18734929.1138750010869--


More information about the mythtv-dev mailing list