From 8bea76d0df509b8d3f570d67a1855efa49c3eaaf Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 28 Jul 2009 15:35:00 +0200 Subject: [PATCH] Revert "more standard conform handling for dvb-text encodings" This reverts commit efdb7161844b7be58cdc5ec3308d8aaf5b257894. --- data/encoding.conf | 56 +++++++++++++++++++++++++-------------------------- lib/base/encoding.cpp | 2 +- lib/base/estring.cpp | 17 +++------------- lib/base/estring.h | 4 ++-- 4 files changed, 33 insertions(+), 46 deletions(-) diff --git a/data/encoding.conf b/data/encoding.conf index 28b7077..c46951e 100644 --- a/data/encoding.conf +++ b/data/encoding.conf @@ -1,26 +1,28 @@ -# 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 -deu ISO8859-9 # i.e. needed for SKY Germany... they dont send a encoding in most dvb-texts ;( -pol ISO8859-2 # this is needed by all known polish providers -tur ISO8859-9 # is this realy needed .. please recheck and report -gre ISO8859-7 # is this realy needed .. please recheck and report -rus ISO8859-5 # is this realy needed .. please recheck and report -bul ISO8859-5 # is this realy needed .. please recheck and report - -# 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! - +#Fallback encoding when in dvb-text no encoding table is given +#Countycode ISO8859-X or ISO6397 +tur ISO8859-9 +gre ISO8859-7 +pol ISO8859-2 +rus ISO8859-5 +bul ISO8859-5 +#Sorry for that.. in DVB Spec this is the default behavior +#when no other encoding is given in dvb-texts.. +#but this breaks too much providers yet.. +#so our default is ISO8859-1 without two char byte encoding +#So all transponders which needs this must be listed here #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,15 +35,11 @@ bul ISO8859-5 # is this realy needed .. please recheck and report 1000 318 #Grupa ITI 1600 318 #Filmbox Polska and other 12200 318 #Disney Channel Polska and other -12800 318 #Viacom ... MTV / VH1 Polska 13000 318 #BBC Polska and other - -# 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 - +#Fallback encoding table for single transponders +#ISO6397 also enables two byte char encoding #TSID ONID ISO8859-X +12800 318 ISO6397 #Viacom ... MTV / VH1 Polska 21100 126 ISO8859-9 # Digital Platform 7°E 10.928 H 30.000 2/3 8PSK 41200 126 ISO8859-9 # Digital Platform 7°E 11.451 V 25.066 2/3 50100 126 ISO8859-9 # Digital Platform 7°E 11.471 H 30.000 3/4 diff --git a/lib/base/encoding.cpp b/lib/base/encoding.cpp index e4e1531..8b4b592 100644 --- a/lib/base/encoding.cpp +++ b/lib/base/encoding.cpp @@ -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; // Latin1/ISO6397 + return 1; // ISO8859-1 / Latin1 } diff --git a/lib/base/estring.cpp b/lib/base/estring.cpp index 40b9802..e7dc2be 100644 --- a/lib/base/estring.cpp +++ b/lib/base/estring.cpp @@ -325,7 +325,7 @@ static inline unsigned int recode(unsigned char d, int cp) return d; switch (cp) { - case 0: // Latin1/ISO6397 <-> unicode mapping + case 0: // ISO6397 return iso6397[d-0xA0]; case 1: // 8859-1 <-> unicode mapping return d; @@ -371,10 +371,6 @@ 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); @@ -403,7 +399,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; -// eDebug("(0x11)text encoded in ISO-10646-1 (UTF-16)"); + tsidonid = 0; ++i; break; case 0x12: @@ -426,22 +422,15 @@ 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 %d", table); - break; } - 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 + bool useTwoCharMapping = !table || tsidonid && encodingHandler.getTransponderUseTwoCharMapping(tsidonid); 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("tsid %04x, onid %04x, used table is now %d, twoChar %d", tsidonid >> 16, tsidonid & 0xFFFF, table, useTwoCharMapping); - unsigned char res[2048]; while (i < len) { diff --git a/lib/base/estring.h b/lib/base/estring.h index d61489e..99b839b 100644 --- a/lib/base/estring.h +++ b/lib/base/estring.h @@ -12,7 +12,7 @@ int strnicmp(const char*, const char*, int); std::string getNum(int num, int base=10); -std::string convertDVBUTF8(const unsigned char *data, int len, int table=0, int tsidonid=0); // with default ISO8859-1/Latin1 +std::string convertDVBUTF8(const unsigned char *data, int len, int table=1, int tsidonid=0); // with default ISO8859-1 / Latin1 std::string convertLatin1UTF8(const std::string &string); int isUTF8(const std::string &string); @@ -20,7 +20,7 @@ std::string removeDVBChars(const std::string &s); void makeUpper(std::string &s); std::string replace_all(const std::string &in, const std::string &entity, const std::string &symbol); -inline std::string convertDVBUTF8(const std::string &string, int table=0, int tsidonid=0) // with default ISO8859-1/Latin1 +inline std::string convertDVBUTF8(const std::string &string, int table=1, int tsidonid=0) // with default ISO8859-1 / Latin1 { return convertDVBUTF8((const unsigned char*)string.c_str(), string.length(), table, tsidonid); } -- 2.7.4