From: Felix Domke Date: Wed, 31 Aug 2005 18:20:45 +0000 (+0000) Subject: - fix character conversion for DVB X-Git-Tag: 2.6.0~5647 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/4269ecde13580077c4d234b21784f704bf43e8fc - fix character conversion for DVB --- diff --git a/lib/base/estring.cpp b/lib/base/estring.cpp index f0107b6a..aee17429 100644 --- a/lib/base/estring.cpp +++ b/lib/base/estring.cpp @@ -3,6 +3,7 @@ #include #include #include +#include static pthread_mutex_t lock=PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP; @@ -181,7 +182,12 @@ static inline unsigned int recode(unsigned char d, int cp) } } -std::string convertDVBUTF8(unsigned char *data, int len, int table) +std::string convertDVBUTF8(const std::string &s, int table) +{ + return convertDVBUTF8((const unsigned char*)s.c_str(), s.size(), table); +} + +std::string convertDVBUTF8(const unsigned char *data, int len, int table) { int i; if (!len) diff --git a/lib/base/estring.h b/lib/base/estring.h index 9cc3180f..a0b161de 100644 --- a/lib/base/estring.h +++ b/lib/base/estring.h @@ -9,8 +9,9 @@ int strnicmp(const char*, const char*, int); std::string getNum(int num, int base=10); -std::string convertDVBUTF8(unsigned char *data, int len, int table=5); +std::string convertDVBUTF8(const unsigned char *data, int len, int table=5); std::string convertUTF8DVB(const std::string &string); // with default ISO8859-5 +std::string convertDVBUTF8(const std::string &s, int table=5); std::string convertLatin1UTF8(const std::string &string); int isUTF8(const std::string &string); diff --git a/lib/dvb/db.cpp b/lib/dvb/db.cpp index 067b0032..6e3207e0 100644 --- a/lib/dvb/db.cpp +++ b/lib/dvb/db.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -29,7 +30,7 @@ eDVBService &eDVBService::operator=(const eDVBService &s) RESULT eDVBService::getName(const eServiceReference &ref, std::string &name) { - name = m_service_name; + name = convertDVBUTF8(m_service_name); return 0; } diff --git a/lib/service/event.cpp b/lib/service/event.cpp index 58079da0..482527cc 100644 --- a/lib/service/event.cpp +++ b/lib/service/event.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -17,8 +18,8 @@ RESULT eServiceEvent::parseFrom(Event *evt) case SHORT_EVENT_DESCRIPTOR: { const ShortEventDescriptor *sed = (ShortEventDescriptor*)*desc; - m_event_name = sed->getEventName(); - m_description = sed->getText(); + m_event_name = convertDVBUTF8(sed->getEventName()); + m_description = convertDVBUTF8(sed->getText()); break; } }