From f2c394d34a22f07d8091b9a1e9682dcf1471eb42 Mon Sep 17 00:00:00 2001 From: Hidetoshi Niisaka Date: Thu, 27 Jun 2013 16:36:16 +0900 Subject: [PATCH] =?UTF-8?q?=E5=85=A8=E8=A7=92=E8=8B=B1=E6=95=B0=E8=A8=98?= =?UTF-8?q?=E5=8F=B7=E3=82=92=E5=8D=8A=E8=A7=92=E3=81=AB=E5=A4=89=E6=8F=9B?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ”は“と対で使われることが多いので全角のまま保持。 一番根本のTS解析部分での変換なので、元が全角であったという情報は失われる。 録画ファイル名は駄目文字のチェックが入っているので、多分問題ない。(未検証) 受信した文字を全て変換しているので、チャンネルスキャンからやりなせばサービス名も半角になります。 --- Common/StringUtil.cpp | 27 +++++++++++++++++++ Common/StringUtil.h | 2 ++ EpgDataCap3/EpgDataCap3/DecodeUtil.cpp | 6 +++++ EpgDataCap3/EpgDataCap3/EpgDBUtil.cpp | 18 +++++++++++++ .../EpgDataCap3/EpgDataCap3.vcxproj.user | 2 +- 5 files changed, 54 insertions(+), 1 deletion(-) diff --git a/Common/StringUtil.cpp b/Common/StringUtil.cpp index 2b16a570ba..446a3c1fc2 100644 --- a/Common/StringUtil.cpp +++ b/Common/StringUtil.cpp @@ -450,3 +450,30 @@ void EscapeXmlString(wstring& src) Replace(src, L"\"", L"""); Replace(src, L"'", L"'"); } + +void ZtoH(wstring &src) +{ + const static wstring from(L"@Ifij{C|D^FGHmnOQeobp"); + const static wstring to(L" !#$%&'()*+,-./:;<=>?@[\\]^_`{|}"); + + for(wstring::iterator it = src.begin(); it != src.end(); it++) + { + if (*it >= L'O' && *it <= L'X') + { + *it -= (L'O' - L'0'); + } + else if (*it >= L'' && *it <= L'') + { + *it -= (L'' - L'a'); + } + else if (*it >= L'`' && *it <= L'y') + { + *it -= (L'`' - L'A'); + } + else + { + int i = from.find(*it); + if (i != wstring::npos) *it = to[i]; + } + } +} diff --git a/Common/StringUtil.h b/Common/StringUtil.h index 35877eb8d3..529b38879f 100644 --- a/Common/StringUtil.h +++ b/Common/StringUtil.h @@ -49,4 +49,6 @@ wstring Tolower(wstring src); void EscapeXmlString(wstring& src); +void ZtoH(wstring &src); + #endif diff --git a/EpgDataCap3/EpgDataCap3/DecodeUtil.cpp b/EpgDataCap3/EpgDataCap3/DecodeUtil.cpp index b0db9dc7f3..920b5d7de1 100644 --- a/EpgDataCap3/EpgDataCap3/DecodeUtil.cpp +++ b/EpgDataCap3/EpgDataCap3/DecodeUtil.cpp @@ -872,6 +872,7 @@ DWORD CDecodeUtil::GetServiceListActual( string network_name = ""; arib.PSISI((const BYTE*)networkName->char_name, networkName->char_nameLength, &network_name); AtoW(network_name, network_nameW); + ZtoH(network_nameW); } } } @@ -884,6 +885,7 @@ DWORD CDecodeUtil::GetServiceListActual( string ts_name = ""; arib.PSISI((const BYTE*)TSInfo->ts_name_char, TSInfo->length_of_ts_name, &ts_name); AtoW(ts_name, ts_nameW); + ZtoH(ts_nameW); } remote_control_key_id = TSInfo->remote_control_key_id; } @@ -917,7 +919,9 @@ DWORD CDecodeUtil::GetServiceListActual( wstring service_provider_nameW = L""; wstring service_nameW = L""; AtoW(service_provider_name, service_provider_nameW); + ZtoH(service_provider_nameW); AtoW(service_name, service_nameW); + ZtoH(service_nameW); this->serviceList[count].extInfo->service_type = service->service_type; if( service_provider_nameW.size() > 0 ){ @@ -1018,7 +1022,9 @@ DWORD CDecodeUtil::GetServiceListSIT( wstring service_provider_nameW = L""; wstring service_nameW = L""; AtoW(service_provider_name, service_provider_nameW); + ZtoH(service_provider_nameW); AtoW(service_name, service_nameW); + ZtoH(service_nameW); this->serviceList[i].extInfo->service_type = service->service_type; if( service_provider_nameW.size() > 0 ){ diff --git a/EpgDataCap3/EpgDataCap3/EpgDBUtil.cpp b/EpgDataCap3/EpgDataCap3/EpgDBUtil.cpp index 9eb2776743..a8d11626e2 100644 --- a/EpgDataCap3/EpgDataCap3/EpgDBUtil.cpp +++ b/EpgDataCap3/EpgDataCap3/EpgDBUtil.cpp @@ -588,7 +588,9 @@ BOOL CEpgDBUtil::AddShortEvent(CEITTable* eit, EVENT_INFO* eventInfo, CShortEven arib.PSISI((const BYTE*)shortEvent->text_char, shortEvent->text_length, &text_char); AtoW(event_name, eventInfo->shortInfo->event_name); + ZtoH(eventInfo->shortInfo->event_name); AtoW(text_char, eventInfo->shortInfo->text_char); + ZtoH(eventInfo->shortInfo->text_char); } return updateFlag; @@ -615,7 +617,9 @@ BOOL CEpgDBUtil::AddShortEvent_SD(CEITTable_SD* eit, EVENT_INFO* eventInfo, CSho arib.PSISI((const BYTE*)shortEvent->text_char, shortEvent->text_length, &text_char); AtoW(event_name, eventInfo->shortInfo->event_name); + ZtoH(eventInfo->shortInfo->event_name); AtoW(text_char, eventInfo->shortInfo->text_char); + ZtoH(eventInfo->shortInfo->text_char); } return updateFlag; @@ -730,6 +734,7 @@ BOOL CEpgDBUtil::AddExtEvent(CEITTable* eit, EVENT_INFO* eventInfo, vectorextInfo->text_char); + ZtoH(eventInfo->extInfo->text_char); } return updateFlag; @@ -844,6 +849,7 @@ BOOL CEpgDBUtil::AddExtEvent_SD(CEITTable_SD* eit, EVENT_INFO* eventInfo, vector //} AtoW(extendText, eventInfo->extInfo->text_char); + ZtoH(eventInfo->extInfo->text_char); } return updateFlag; @@ -913,6 +919,7 @@ BOOL CEpgDBUtil::AddComponent(CEITTable* eit, EVENT_INFO* eventInfo, CComponentD arib.PSISI((const BYTE*)component->text_char, component->text_charLength, &text_char); AtoW(text_char, eventInfo->componentInfo->text_char); + ZtoH(eventInfo->componentInfo->text_char); } } @@ -944,6 +951,7 @@ BOOL CEpgDBUtil::AddComponent_SD(CEITTable_SD* eit, EVENT_INFO* eventInfo, CComp arib.PSISI((const BYTE*)component->text_char, component->text_charLength, &text_char); AtoW(text_char, eventInfo->componentInfo->text_char); + ZtoH(eventInfo->componentInfo->text_char); } } @@ -989,6 +997,7 @@ BOOL CEpgDBUtil::AddAudioComponent(CEITTable* eit, EVENT_INFO* eventInfo, vector arib.PSISI((const BYTE*)audioComponent->text_char, audioComponent->text_charLength, &text_char); AtoW(text_char, item.text_char); + ZtoH(item.text_char); } eventInfo->audioInfo->componentList.push_back(item); @@ -1038,6 +1047,7 @@ BOOL CEpgDBUtil::AddAudioComponent_SD(CEITTable_SD* eit, EVENT_INFO* eventInfo, arib.PSISI((const BYTE*)audioComponent->text_char, audioComponent->text_charLength, &text_char); AtoW(text_char, item.text_char); + ZtoH(item.text_char); } eventInfo->audioInfo->componentList.push_back(item); @@ -1352,6 +1362,7 @@ BOOL CEpgDBUtil::AddServiceList(CNITTable* nit) string network_name = ""; arib.PSISI((const BYTE*)networkName->char_name, networkName->char_nameLength, &network_name); AtoW(network_name, network_nameW); + ZtoH(network_nameW); } } } @@ -1386,6 +1397,7 @@ BOOL CEpgDBUtil::AddServiceList(CNITTable* nit) string ts_name = ""; arib.PSISI((const BYTE*)desc->TSInfo->ts_name_char, desc->TSInfo->length_of_ts_name, &ts_name); AtoW(ts_name, itrFind->second->ts_name); + ZtoH(itrFind->second->ts_name); } itrFind->second->remote_control_key_id = desc->TSInfo->remote_control_key_id; } @@ -1448,7 +1460,9 @@ BOOL CEpgDBUtil::AddServiceList(WORD TSID, CSITTable* sit) arib.PSISI((const BYTE*)service->char_service_name, service->service_name_length, &service_name); } AtoW(service_provider_name, item->service_provider_name); + ZtoH(item->service_provider_name); AtoW(service_name, item->service_name); + ZtoH(item->service_name); item->service_type = service->service_type; } @@ -1494,7 +1508,9 @@ BOOL CEpgDBUtil::AddSDT(CSDTTable* sdt) arib.PSISI((const BYTE*)service->char_service_name, service->service_name_length, &service_name); } AtoW(service_provider_name, item->service_provider_name); + ZtoH(item->service_provider_name); AtoW(service_name, item->service_name); + ZtoH(item->service_name); item->service_type = service->service_type; } @@ -1525,7 +1541,9 @@ BOOL CEpgDBUtil::AddSDT(CSDTTable* sdt) arib.PSISI((const BYTE*)service->char_service_name, service->service_name_length, &service_name); } AtoW(service_provider_name, item->service_provider_name); + ZtoH(item->service_provider_name); AtoW(service_name, item->service_name); + ZtoH(item->service_name); item->service_type = service->service_type; } diff --git a/EpgDataCap3/EpgDataCap3/EpgDataCap3.vcxproj.user b/EpgDataCap3/EpgDataCap3/EpgDataCap3.vcxproj.user index c88822b454..b6f091c163 100644 --- a/EpgDataCap3/EpgDataCap3/EpgDataCap3.vcxproj.user +++ b/EpgDataCap3/EpgDataCap3/EpgDataCap3.vcxproj.user @@ -2,7 +2,7 @@ ..\..\x86\Debug\EpgTimerSrv.exe - ..\..\x86\Debug + $(SolutionDir)..\x86\$(Configuration)\ WindowsLocalDebugger \ No newline at end of file