Ticket #1025: iso8859.diff
File iso8859.diff, 1.7 KB (added by , 18 years ago) |
---|
-
libs/libmythtv/siparser.cpp
957 957 unsigned char buf[length]; 958 958 memcpy(buf, src, length); 959 959 960 if ((buf[0] < 0x10) || (buf[0] >= 0x20) )960 if ((buf[0] < 0x10) || (buf[0] >= 0x20) || (buf[0] == 0x10)) 961 961 { 962 962 // Strip formatting characters 963 963 for (uint p = 0; p < length; p++) … … 976 976 QTextCodec *codec = QTextCodec::codecForName(coding); 977 977 result = codec->toUnicode((const char*)buf + 1, length - 1); 978 978 } 979 else if (buf[0] == 0x10) 980 { 981 // If the first byte of the text field has a value "0x10" then the following two bytes carry a 16-bit value (uimsbf) N 982 // to indicate that the remaining data of the text field is coded using the character code table specified by 983 // ISO Standard 8859, parts 1 to 9 984 985 uint code = 1; 986 swab(buf + 1, &code, 2); 987 QString coding = "ISO8859-" + QString::number(code); 988 QTextCodec *codec = QTextCodec::codecForName(coding); 989 result = codec->toUnicode((const char*)buf + 3, length - 3); 990 } 979 991 else 980 992 { 981 993 // Unknown/invalid encoding - assume local8Bit 982 994 result = QString::fromLocal8Bit((const char*)buf + 1, length - 1); 983 995 } 984 996 } 985 997 else 986 998 { 987 999 // TODO: Handle multi-byte encodings 988 1000 989 990 1001 VERBOSE(VB_SIPARSER, LOC + "Multi-byte coded text - not supported!"); 1002 result = "N/A"; 991 1003 } 992 1004 993 1005 return result;