fix quotes

This commit is contained in:
Kulikova Svetlana
2022-03-11 18:29:47 +03:00
parent a90b578e9c
commit 8bb58c35cb
2 changed files with 20 additions and 2 deletions

View File

@ -169,7 +169,10 @@
this.pages.push(rec);
}
var json_info = reader.readString();
this.info = JSON.parse(json_info);
try
{
this.info = JSON.parse(json_info);
} catch(err) {}
Module["_free"](_info);
return this.pages.length > 0;

View File

@ -435,6 +435,18 @@ return 0;
// return wsXml;
return L"";
}
void replace_all(std::wstring& s, const std::wstring& s1, const std::wstring& s2)
{
size_t pos = s.find(s1);
size_t l = s2.length();
while (pos != std::wstring::npos)
{
s.replace(pos, s1.length(), s2);
pos = s.find(s1, pos + l);
}
}
#define DICT_LOOKUP(sName, wsName) \
if (info.dictLookup(sName, &obj1)->isString())\
{\
@ -442,7 +454,9 @@ return 0;
sRes += L"\"";\
sRes += wsName;\
sRes += L"\":\"";\
sRes += NSStringExt::CConverter::GetUnicodeFromUTF32(s->getUnicode(), s->getLength());\
std::wstring sValue = NSStringExt::CConverter::GetUnicodeFromUTF32(s->getUnicode(), s->getLength());\
replace_all(sValue, L"\"", L"\\\"");\
sRes += sValue;\
sRes += L"\",";\
delete s;\
}\
@ -459,6 +473,7 @@ return 0;
std::wstring sDate = sNoDate.substr(2, 4) + L'-' + sNoDate.substr(6, 2) + L'-' + sNoDate.substr(8, 2) + L'T' +\
sNoDate.substr(10, 2) + L':' + sNoDate.substr(12, 2) + L':' + sNoDate.substr(14, 2) + L".000+" +\
sNoDate.substr(17, 2) + L':' + sNoDate.substr(20, 2);\
replace_all(sDate, L"\"", L"\\\"");\
sRes += L"\"";\
sRes += wsName;\
sRes += L"\":\"";\