From: ghost Date: Sat, 25 Jul 2009 12:13:05 +0000 (+0200) Subject: more standard conform handling for dvb-text encodings X-Git-Tag: 2.6.0~189 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/efdb7161844b7be58cdc5ec3308d8aaf5b257894?hp=cddb13ae57507610df08f5f11e0b19a7e36f63cb more standard conform handling for dvb-text encodings with this fix no more special handling for UPC Direkt transponders on 19.2°E and CS Link on 23.5°E is needed but some polish providers still needs special handling... i think they interpreted the spec in the wrong way --- diff --git a/data/encoding.conf b/data/encoding.conf index 29816ce3..691f0027 100644 --- a/data/encoding.conf +++ b/data/encoding.conf @@ -1,24 +1,25 @@ -#Fallback encoding when in dvb-text no encoding table is given +# Fallback encoding when in dvb-text no encoding table is given. In normal +# case this then is Latin1/ISO6397 with enabled two char byte mapping. +# But here we override this for all EIT entries with given country code + #Countycode ISO8859-X tur ISO8859-9 gre ISO8859-7 pol ISO8859-2 rus ISO8859-5 bul ISO8859-5 -#Table of transponder using two byte char mappings (VideoTexSuppl) + +# Table of transponder using two byte char mappings +# in normal case two char byte mapping is only used when in dvb-text no +# encoding is given... but some providers use two-char byte mapping in +# combination with other ISO8859-X tables.. so here it can be enabled +# for some TSID/ONID combinations +# a special case is when in dvb-text ISO8859-5 is selected... then +# we also change the char table to ISO6397 this is used by +# Cyfra+ and Cyfrowy Polsat and other polish providers +# please report when you have an idea how to auto detect this! + #TSID ONID -0x447 0x1 #ASTRA 19.2° UPC Direct -0x427 0x1 -0x44b 0x1 -0x4ff 0x1 -0x407 0x1 -0x436 0x1 #ASTRA 19.2° MTV Euro - MTV Networks -0x42a 0x1 #ASTRA 19.2° VH1 Classic - MTV Networks -0xbc6 0x3 #ASTRA 23.5° Cslink, Skylink -0xc85 0x3 -0xc89 0x3 -0xc8f 0x3 -0xbc7 0x3 400 318 #Hotbird 13.0° Cyfra+ 1500 318 11000 318 @@ -33,9 +34,13 @@ bul ISO8859-5 12200 318 #Disney Channel Polska and other 12800 318 #Viacom ... MTV / VH1 Polska 13000 318 #BBC Polska and other -#Fallback encoding table for following transponders + +# Fallback encoding when in dvb-text no encoding table is given. In normal +# case this then is Latin1/ISO6397 with enabled two char byte mapping. +# But here we override this for all EIT entries on transponders with given +# TSID/ONID combination + #TSID ONID ISO8859-X -#0x447 0x1 ISO8859-9 50200 126 ISO8859-9 # Digiturk 7°E 11.492 V 30.000 3/4 50300 126 ISO8859-9 # Digiturk 7°E 11.639 H 30.000 3/4 50400 126 ISO8859-9 # Digiturk 7°E 11.534 V 30.000 3/4 @@ -44,4 +49,3 @@ bul ISO8859-5 50800 126 ISO8859-9 # Digiturk 7°E 11.678 H 30.000 3/4 50900 126 ISO8859-9 # Skyturk 7°E 11.513 H 27.500 3/4 51000 126 ISO8859-9 # Digiturk 7°E 11.617 V 30.000 3/4 -12800 318 ISO6397 #Viacom ... MTV / VH1 Polska diff --git a/lib/base/encoding.cpp b/lib/base/encoding.cpp index 831de847..e4e1531c 100644 --- a/lib/base/encoding.cpp +++ b/lib/base/encoding.cpp @@ -42,14 +42,14 @@ eDVBTextEncodingHandler::eDVBTextEncodingHandler() } else if ( (sscanf( line, "0x%x 0x%x ISO%d", &tsid, &onid, &encoding ) == 3 && encoding == 6397 ) ||(sscanf( line, "%d %d ISO%d", &tsid, &onid, &encoding ) == 3 && encoding == 6397 ) ) - m_TransponderDefaultMapping[(tsid<<16)|onid]=64; + m_TransponderDefaultMapping[(tsid<<16)|onid]=0; else if ( sscanf( line, "%s ISO%d", countrycode, &encoding ) == 2 && encoding == 6397 ) { - m_CountryCodeDefaultMapping[countrycode]=64; + m_CountryCodeDefaultMapping[countrycode]=0; countrycode[0]=toupper(countrycode[0]); countrycode[1]=toupper(countrycode[1]); countrycode[2]=toupper(countrycode[2]); - m_CountryCodeDefaultMapping[countrycode]=64; + m_CountryCodeDefaultMapping[countrycode]=0; } else if ( (sscanf( line, "0x%x 0x%x", &tsid, &onid ) == 2 ) ||(sscanf( line, "%d %d", &tsid, &onid ) == 2 ) ) @@ -83,5 +83,5 @@ int eDVBTextEncodingHandler::getCountryCodeDefaultMapping( const std::string &co m_CountryCodeDefaultMapping.find(country_code); if ( it != m_CountryCodeDefaultMapping.end() ) return it->second; - return 0; // ISO8859-1 / Latin1 + return 0; // Latin1/ISO6397 } diff --git a/lib/base/estring.cpp b/lib/base/estring.cpp index be071454..728a4c4f 100644 --- a/lib/base/estring.cpp +++ b/lib/base/estring.cpp @@ -152,11 +152,11 @@ static unsigned long c885916[96]={ 0x0111, 0x0144, 0x00F2, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x015B, 0x0171, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0119, 0x021B, 0x00FF}; static unsigned long iso6397[96]={ -0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x0000, 0x00A5, 0x0000, 0x00A7, 0x00A4, 0x2018, 0x201C, 0x00AB, 0x2190, 0x2191, 0x2192, 0x2193, +0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x20AC, 0x00A5, 0x0000, 0x00A7, 0x00A4, 0x2018, 0x201C, 0x00AB, 0x2190, 0x2191, 0x2192, 0x2193, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00D7, 0x00B5, 0x00B6, 0x00B7, 0x00F7, 0x2019, 0x201D, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, 0x0000, 0xE002, 0xE003, 0xE004, 0xE005, 0xE006, 0xE007, 0xE008, 0xE009, 0xE00C, 0xE00A, 0xE00B, 0x0000, 0xE00D, 0xE00E, 0xE00F, -0x2014, 0x00B9, 0x00AE, 0x00A9, 0x2122, 0x266A, 0x00AC, 0x00A6, 0x0000, 0x0000, 0x0000, 0x0000, 0x215B, 0x215C, 0x215D, 0x215E, -0x2126, 0x00C6, 0x00D0, 0x00AA, 0x0126, 0x0000, 0x0132, 0x013F, 0x0141, 0x00D8, 0x0152, 0x00BA, 0x00DE, 0x0166, 0x014A, 0x0149, +0x2015, 0x00B9, 0x00AE, 0x00A9, 0x2122, 0x266A, 0x00AC, 0x00A6, 0x0000, 0x0000, 0x0000, 0x0000, 0x215B, 0x215C, 0x215D, 0x215E, +0x2126, 0x00C6, 0x0110, 0x00AA, 0x0126, 0x0000, 0x0132, 0x013F, 0x0141, 0x00D8, 0x0152, 0x00BA, 0x00DE, 0x0166, 0x014A, 0x0149, 0x0138, 0x00E6, 0x0111, 0x00F0, 0x0127, 0x0131, 0x0133, 0x0140, 0x0142, 0x00F8, 0x0153, 0x00DF, 0x00FE, 0x0167, 0x014B, 0x00AD}; // Two Char Mapping (aka ISO6397) ( many polish services and UPC Direct/HBO services) @@ -325,7 +325,8 @@ static inline unsigned int recode(unsigned char d, int cp) return d; switch (cp) { - case 0: // Latin1 <-> unicode mapping + case 0: // Latin1/ISO6397 <-> unicode mapping + return iso6397[d-0xA0]; case 1: // 8859-1 <-> unicode mapping return d; case 2: // 8859-2 -> unicode mapping @@ -358,8 +359,6 @@ static inline unsigned int recode(unsigned char d, int cp) return c885915[d-0xA0]; case 16:// 8859-16 -> unicode mapping return c885916[d-0xA0]; - case 64:// iso6397 - return iso6397[d-0xA0]; default: return d; } @@ -372,6 +371,10 @@ std::string convertDVBUTF8(const unsigned char *data, int len, int table, int ts int i=0, t=0; + // table given two this function is default 0... but when a default table for a country code is set in encoding.conf + // then here this table is given + + // when a tsid/onid is avail the table can be overriden in encoding.conf based on tsid/onid combinations if ( tsidonid ) encodingHandler.getTransponderDefaultMapping(tsidonid, table); @@ -400,7 +403,7 @@ std::string convertDVBUTF8(const unsigned char *data, int len, int table, int ts } case 0x11: // Basic Multilingual Plane of ISO/IEC 10646-1 enc (UTF-16... Unicode) table = 65; - tsidonid = 0; +// eDebug("(0x11)text encoded in ISO-10646-1 (UTF-16)"); ++i; break; case 0x12: @@ -423,16 +426,22 @@ std::string convertDVBUTF8(const unsigned char *data, int len, int table, int ts eDebug("reserved %d", data[0]); ++i; break; + default: +// eDebug("no encoding in dvb string given.. use default table"); + break; } - bool useTwoCharMapping = - tsidonid && encodingHandler.getTransponderUseTwoCharMapping(tsidonid); + bool useTwoCharMapping = (!table) || (tsidonid && encodingHandler.getTransponderUseTwoCharMapping(tsidonid)); + // two char byte mapping is default enabled for table 0 (ISO6397) (described in ETSI EN300468) + // or it can be enabled for tsid/onid combinations in our encoding.conf - if (useTwoCharMapping) { - if (table == 5) - table = 64; + if (useTwoCharMapping && table == 5) { // i hope this dont break other transponders which realy use ISO8859-5 and two char byte mapping... +// eDebug("Cyfra / Cyfrowy Polsat HACK... override given ISO8859-5 with ISO6397"); + table = 0; } + eDebug("used table is now %d, twoChar %d", table, useTwoCharMapping); + unsigned char res[2048]; while (i < len) { @@ -536,8 +545,8 @@ std::string convertUTF8DVB(const std::string &string, int table) case 11: coding_table = c885911; break; -/* case 12: // reserved.. for indian use - coding_table = c885912; +/* case 12: // reserved.. for indian use + coding_table = c885912; break;*/ case 13: coding_table = c885913;