mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
fix fb2 escaping characters
This commit is contained in:
@ -1589,6 +1589,17 @@ HRESULT CFb2File::Open(const std::wstring& sPath, const std::wstring& sDirectory
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
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::string::npos)
|
||||
{
|
||||
s.replace(pos, s1.length(), s2);
|
||||
pos = s.find(s1, pos + l);
|
||||
}
|
||||
}
|
||||
|
||||
void readLi(NSStringUtils::CStringBuilder& oXml, NSStringUtils::CStringBuilder& oTitleInfo, XmlUtils::CXmlLiteReader& oIndexHtml, std::vector<std::wstring>& arrBinary, bool bUl, bool bWasP, bool bWasTable);
|
||||
void readStream(NSStringUtils::CStringBuilder& oXml, NSStringUtils::CStringBuilder& oTitleInfo, XmlUtils::CXmlLiteReader& oIndexHtml, std::vector<std::wstring>& arrBinary, bool bWasP, bool bWasTable)
|
||||
{
|
||||
@ -1625,6 +1636,12 @@ void readStream(NSStringUtils::CStringBuilder& oXml, NSStringUtils::CStringBuild
|
||||
|
||||
if (!sAtrName.empty())
|
||||
{
|
||||
replace_all(sAtrContent, L"&", L"&");
|
||||
replace_all(sAtrContent, L"<", L"<");
|
||||
replace_all(sAtrContent, L">", L">");
|
||||
replace_all(sAtrContent, L"\"", L""");
|
||||
replace_all(sAtrContent, L"\'", L"'");
|
||||
|
||||
if (sAtrName == L"creator")
|
||||
oTitleInfo.WriteString(L"<author><nickname>" + sAtrContent + L"</nickname></author>");
|
||||
else if (sAtrName == L"description")
|
||||
|
||||
Reference in New Issue
Block a user