mirror of
https://github.com/QIDITECH/QIDIStudio.git
synced 2026-02-07 04:11:50 +03:00
update libslic3r
This commit is contained in:
@@ -1210,6 +1210,34 @@ std::string xml_escape(std::string text, bool is_marked/* = false*/)
|
||||
return text;
|
||||
}
|
||||
|
||||
// Definition of escape symbols https://www.w3.org/TR/REC-xml/#AVNormalize
|
||||
// During the read of xml attribute normalization of white spaces is applied
|
||||
// Soo for not lose white space character it is escaped before store
|
||||
std::string xml_escape_double_quotes_attribute_value(std::string text)
|
||||
{
|
||||
std::string::size_type pos = 0;
|
||||
for (;;) {
|
||||
pos = text.find_first_of("\"&<\r\n\t", pos);
|
||||
if (pos == std::string::npos) break;
|
||||
|
||||
std::string replacement;
|
||||
switch (text[pos]) {
|
||||
case '\"': replacement = """; break;
|
||||
case '&': replacement = "&"; break;
|
||||
case '<': replacement = "<"; break;
|
||||
case '\r': replacement = "
"; break;
|
||||
case '\n': replacement = "
"; break;
|
||||
case '\t': replacement = "	"; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
text.replace(pos, 1, replacement);
|
||||
pos += replacement.size();
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
std::string xml_unescape(std::string s)
|
||||
{
|
||||
std::string ret;
|
||||
|
||||
Reference in New Issue
Block a user