diff --git a/src/driver/record.cpp b/src/driver/record.cpp index aa7da3d1a..73dd04abc 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -288,7 +288,7 @@ bool CRecordInstance::Update() EPG_AUDIO_PIDS audio_pids; audio_pids.epgAudioPid = allpids.APIDs[i].pid; - audio_pids.epgAudioPidName = ZapitTools::UTF8_to_UTF8XML(g_RemoteControl->current_PIDs.APIDs[i].desc); + audio_pids.epgAudioPidName = g_RemoteControl->current_PIDs.APIDs[i].desc; audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : 0; audio_pids.selected = 0; recMovieInfo->audioPids.push_back(audio_pids); @@ -506,7 +506,7 @@ void CRecordInstance::FillMovieInfo(CZapitChannel * channel, APIDList & apid_lis if (tmpstring.empty()) recMovieInfo->epgChannel = "unknown"; else - recMovieInfo->epgChannel = ZapitTools::UTF8_to_UTF8XML(tmpstring.c_str()); + recMovieInfo->epgChannel = tmpstring; tmpstring = "not available"; if (epgid != 0) { @@ -527,10 +527,10 @@ void CRecordInstance::FillMovieInfo(CZapitChannel * channel, APIDList & apid_lis } else if (!epgTitle.empty()) { tmpstring = epgTitle; } - recMovieInfo->epgTitle = ZapitTools::UTF8_to_UTF8XML(tmpstring.c_str()); + recMovieInfo->epgTitle = tmpstring; recMovieInfo->epgId = channel->getChannelID(); - recMovieInfo->epgInfo1 = ZapitTools::UTF8_to_UTF8XML(info1.c_str()); - recMovieInfo->epgInfo2 = ZapitTools::UTF8_to_UTF8XML(info2.c_str()); + recMovieInfo->epgInfo1 = info1; + recMovieInfo->epgInfo2 = info2; recMovieInfo->epgEpgId = epgid; recMovieInfo->epgMode = g_Zapit->getMode(); recMovieInfo->epgVideoPid = allpids.PIDs.vpid; @@ -542,7 +542,7 @@ void CRecordInstance::FillMovieInfo(CZapitChannel * channel, APIDList & apid_lis for(it = apid_list.begin(); it != apid_list.end(); it++) { if(allpids.APIDs[i].pid == it->apid) { audio_pids.epgAudioPid = allpids.APIDs[i].pid; - audio_pids.epgAudioPidName = ZapitTools::UTF8_to_UTF8XML(g_RemoteControl->current_PIDs.APIDs[i].desc); + audio_pids.epgAudioPidName = g_RemoteControl->current_PIDs.APIDs[i].desc; audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : 0; audio_pids.selected = (audio_pids.epgAudioPid == channel->getAudioPid()) ? 1 : 0; recMovieInfo->audioPids.push_back(audio_pids); @@ -553,7 +553,7 @@ void CRecordInstance::FillMovieInfo(CZapitChannel * channel, APIDList & apid_lis if(recMovieInfo->audioPids.empty() && allpids.APIDs.size()) { int i = 0; audio_pids.epgAudioPid = allpids.APIDs[i].pid; - audio_pids.epgAudioPidName = ZapitTools::UTF8_to_UTF8XML(g_RemoteControl->current_PIDs.APIDs[i].desc); + audio_pids.epgAudioPidName = g_RemoteControl->current_PIDs.APIDs[i].desc; audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : 0; audio_pids.selected = 1; recMovieInfo->audioPids.push_back(audio_pids); diff --git a/src/gui/movieinfo.cpp b/src/gui/movieinfo.cpp index eda4e0dbd..32d3ae023 100644 --- a/src/gui/movieinfo.cpp +++ b/src/gui/movieinfo.cpp @@ -119,7 +119,7 @@ bool CMovieInfo::convertTs2XmlName(std::string * filename) ************************************************************************/ #define XML_ADD_TAG_STRING(_xml_text_,_tag_name_,_tag_content_){ \ _xml_text_ += "\t\t<"_tag_name_">"; \ - _xml_text_ += _tag_content_; \ + _xml_text_ += ZapitTools::UTF8_to_UTF8XML(_tag_content_.c_str()); \ _xml_text_ += "\n";} #define XML_ADD_TAG_UNSIGNED(_xml_text_,_tag_name_,_tag_content_){\ @@ -141,7 +141,7 @@ bool CMovieInfo::convertTs2XmlName(std::string * filename) {\ if(_node_->GetData() != NULL)\ {\ - _string_dest_ = _node_->GetData();\ + _string_dest_ = decodeXmlSpecialChars(_node_->GetData());\ }\ }} #define XML_GET_DATA_INT(_node_,_tag_,_int_dest_){\ @@ -201,7 +201,7 @@ bool CMovieInfo::encodeMovieInfoXml(std::string * extMessage, MI_MOVIE_INFO * mo sprintf(tmp, "%u", movie_info->audioPids[i].selected); //pids.APIDs[i].pid); *extMessage += tmp; *extMessage += "\" " MI_XML_TAG_NAME "=\""; - *extMessage += movie_info->audioPids[i].epgAudioPidName; // ZapitTools::UTF8_to_UTF8XML(g_RemoteControl->current_PIDs.APIDs[i].desc); + *extMessage += ZapitTools::UTF8_to_UTF8XML(movie_info->audioPids[i].epgAudioPidName.c_str()); *extMessage += "\"/>\n"; } *extMessage += "\t\t\n"; @@ -235,7 +235,7 @@ bool CMovieInfo::encodeMovieInfoXml(std::string * extMessage, MI_MOVIE_INFO * mo sprintf(tmp, "%d", movie_info->bookmarks.user[i].length); //pids.APIDs[i].pid); *extMessage += tmp; *extMessage += "\" " MI_XML_TAG_BOOKMARK_USER_NAME "=\""; - *extMessage += movie_info->bookmarks.user[i].name; + *extMessage += ZapitTools::UTF8_to_UTF8XML(movie_info->bookmarks.user[i].name.c_str()); *extMessage += "\"/>\n"; } } @@ -372,7 +372,7 @@ bool CMovieInfo::parseXmlTree(char */*text*/, MI_MOVIE_INFO * /*movie_info*/) pids.epgAudioPid = atoi(xam2->GetAttributeValue(MI_XML_TAG_PID)); pids.atype = atoi(xam2->GetAttributeValue(MI_XML_TAG_ATYPE)); pids.selected = atoi(xam2->GetAttributeValue(MI_XML_TAG_SELECTED)); - pids.epgAudioPidName = xam2->GetAttributeValue(MI_XML_TAG_NAME); + pids.epgAudioPidName = decodeXmlSpecialChars(xam2->GetAttributeValue(MI_XML_TAG_NAME)); //printf("MOVIE INFO: apid %d type %d name %s selected %d\n", pids.epgAudioPid, pids.atype, pids.epgAudioPidName.c_str(), pids.selected); movie_info->audioPids.push_back(pids); } @@ -405,16 +405,9 @@ bool CMovieInfo::parseXmlTree(char */*text*/, MI_MOVIE_INFO * /*movie_info*/) } delete parser; - strReplace(movie_info->epgTitle, """, "\""); - strReplace(movie_info->epgInfo1, """, "\""); - strReplace(movie_info->epgTitle, "'", "'"); - strReplace(movie_info->epgInfo1, "'", "'"); if (movie_info->epgInfo2 == "") { movie_info->epgInfo2 = movie_info->epgInfo1; //movie_info->epgInfo1 = ""; - } else { - strReplace(movie_info->epgInfo2, """, "\""); - strReplace(movie_info->epgInfo2, "'", "'"); } #endif /* XMLTREE_LIB */ return (true); @@ -590,6 +583,7 @@ int find_next_char(char to_find, char *text, int start_pos, int end_pos) while(_pos_ < bytes && _text_[_pos_] != '<' ) _pos_++;\ _dest_ = "";\ _dest_.append(&_text_[pos_prev],_pos_ - pos_prev );\ + _dest_ = decodeXmlSpecialChars(_dest_);\ _pos_ += sizeof(_tag_);\ continue;\ } @@ -627,6 +621,16 @@ void strReplace(std::string & orig, const char *fstr, const std::string rstr) } } +std::string decodeXmlSpecialChars(std::string s) +{ + strReplace(s,"<","<"); + strReplace(s,">",">"); + strReplace(s,"&","&"); + strReplace(s,""","\""); + strReplace(s,"'","\'"); + return s; +} + /************************************************************************ ************************************************************************/ bool CMovieInfo::parseXmlQuickFix(char *text, MI_MOVIE_INFO * movie_info) @@ -731,7 +735,10 @@ bool CMovieInfo::parseXmlQuickFix(char *text, MI_MOVIE_INFO * movie_info) while (text[pos + pos3] != '\"' && text[pos + pos3] != 0 && text[pos + pos3] != '/') pos3++; if (text[pos + pos3] == '\"') + { audio_pids.epgAudioPidName.append(&text[pos + pos2 + 1], pos3 - pos2 - 1); + audio_pids.epgAudioPidName = decodeXmlSpecialChars(audio_pids.epgAudioPidName); + } } } printf("MOVIE INFO: apid %d type %d name %s selected %d\n", audio_pids.epgAudioPid, audio_pids.atype, audio_pids.epgAudioPidName.c_str(), audio_pids.selected); @@ -776,7 +783,10 @@ bool CMovieInfo::parseXmlQuickFix(char *text, MI_MOVIE_INFO * movie_info) while (text[pos + pos3] != '\"' && text[pos + pos3] != 0 && text[pos + pos3] != '/') pos3++; if (text[pos + pos3] == '\"') + { movie_info->bookmarks.user[bookmark_nr].name.append(&text[pos + pos2 + 1], pos3 - pos2 - 1); + movie_info->bookmarks.user[bookmark_nr].name = decodeXmlSpecialChars(movie_info->bookmarks.user[bookmark_nr].name); + } } } } @@ -790,16 +800,9 @@ bool CMovieInfo::parseXmlQuickFix(char *text, MI_MOVIE_INFO * movie_info) } } - strReplace(movie_info->epgTitle, """, "\""); - strReplace(movie_info->epgInfo1, """, "\""); - strReplace(movie_info->epgTitle, "'", "'"); - strReplace(movie_info->epgInfo1, "'", "'"); if (movie_info->epgInfo2 == "") { movie_info->epgInfo2 = movie_info->epgInfo1; //movie_info->epgInfo1 = ""; - } else { - strReplace(movie_info->epgInfo2, """, "\""); - strReplace(movie_info->epgInfo2, "'", "'"); } return (true);