diff --git a/src/nhttpd/tuxboxapi/controlapi.cpp b/src/nhttpd/tuxboxapi/controlapi.cpp index 0177836c6..58bc46c60 100644 --- a/src/nhttpd/tuxboxapi/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/controlapi.cpp @@ -3234,6 +3234,7 @@ void CControlAPI::xmltvepgCGI(CyhookHandler *hh) hh->ParamList["format"] = "xml"; hh->outStart(); + bool xml_cdata = false; t_channel_id channel_id; std::string result = ""; std::string channelTag = "", channelData = ""; @@ -3256,7 +3257,7 @@ void CControlAPI::xmltvepgCGI(CyhookHandler *hh) CZapitChannel * channel = chanlist[j]; channel_id = channel->getChannelID() & 0xFFFFFFFFFFFFULL; channelTag = "channel id=\""+string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel_id)+"\""; - channelData = hh->outPair("display-name", hh->outValue(channel->getName()), true); + channelData = hh->outPair("display-name", hh->outValue(channel->getName(), xml_cdata), true); result += hh->outObject(channelTag, channelData); eList.clear(); @@ -3284,8 +3285,8 @@ void CControlAPI::xmltvepgCGI(CyhookHandler *hh) strftime(zbuffer, 21, "%Y%m%d%H%M%S +0200", mtime); programmeTag += "stop=\""+std::string(zbuffer)+"\" "; - programmeData = hh->outPair("title lang=\"de\"", hh->outValue(eventIterator->description), false); - programmeData += hh->outPair("desc lang=\"de\"", hh->outValue(eventIterator->text), true); + programmeData = hh->outPair("title lang=\"de\"", hh->outValue(eventIterator->description, xml_cdata), false); + programmeData += hh->outPair("desc lang=\"de\"", hh->outValue(eventIterator->text, xml_cdata), true); result += hh->outArrayItem(programmeTag, programmeData, false); } diff --git a/src/nhttpd/yhttpd_core/yhook.cpp b/src/nhttpd/yhttpd_core/yhook.cpp index a7bed8b05..79946d5a3 100644 --- a/src/nhttpd/yhttpd_core/yhook.cpp +++ b/src/nhttpd/yhttpd_core/yhook.cpp @@ -540,13 +540,18 @@ std::string CyhookHandler::outObject(std::string _key, std::string _content, boo } //----------------------------------------------------------------------------- -std::string CyhookHandler::outValue(std::string _content) { +std::string CyhookHandler::outValue(std::string _content, bool _xml_cdata) { std::string result = ""; switch (outType) { case xml: - result += ""; + if (_xml_cdata) + { + result = "";; + } + else + { + result = convert_UTF8_To_UTF8_XML(utf8_check_is_valid(_content) ? _content.c_str() : iso_8859_1_to_utf8(_content).c_str()); + } break; case json: result = json_convert_string(_content); diff --git a/src/nhttpd/yhttpd_core/yhook.h b/src/nhttpd/yhttpd_core/yhook.h index 0fefe46a8..8a9209dc4 100644 --- a/src/nhttpd/yhttpd_core/yhook.h +++ b/src/nhttpd/yhttpd_core/yhook.h @@ -211,7 +211,7 @@ public: std::string outArray(std::string _key, std::string _content, bool _next = false); std::string outArrayItem(std::string _key, std::string _content, bool _next); std::string outObject(std::string _key,std::string _content, bool _next = false); - std::string outValue(std::string _content); + std::string outValue(std::string _content, bool _xml_cdata = true); std::string outNext(); friend class CyParser; };