[TD]"<" symbol embedded in html

This commit is contained in:
wandererfan
2020-04-11 15:50:24 -04:00
committed by WandererFan
parent a05ffd4993
commit 4045b2fa3c

View File

@@ -158,10 +158,19 @@ void QGIViewAnnotation::drawAnnotation()
if (it != annoText.begin()) {
ss << "<br>";
}
std::string u8String = Base::Tools::escapedUnicodeToUtf8(*it);
// what madness turns \' into \\\\\'?
std::string apos = std::regex_replace((u8String), std::regex("\\\\\'"), "'");
ss << apos;
//TODO: there is still a bug here. entering "'" works, save and restore works, but edit after
// save and restore brings "\'" back into text. manually deleting the "\" fixes it until the next
// save/restore/edit cycle.
// a guess is that the editor for propertyStringList is too enthusiastic about substituting.
// the substituting might be necessary for using the strings in Python.
// &apos; doesn't seem to help in this case.
std::string u8String = Base::Tools::escapedUnicodeToUtf8(*it); //from \x??\x?? to real utf8
std::string apos = std::regex_replace((u8String), std::regex("\\\\"), ""); //remove doubles.
apos = std::regex_replace((apos), std::regex("\\'"), "'"); //replace escaped apos
//"less than" symbol chops off line. need to use html sub.
std::string lt = std::regex_replace((apos), std::regex("<"), "&lt;");
ss << lt;
}
ss << "<br></p>\n</body>\n</html> ";