mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-23 19:31:44 +00:00
Enhanced the escape_xml function to escape quotes if necessary.
This commit is contained in:
parent
01c0480771
commit
99d2e62869
@ -885,7 +885,8 @@ unescape(const string &source) {
|
||||
}
|
||||
|
||||
string
|
||||
escape_xml(const string &source) {
|
||||
escape_xml(const string &source,
|
||||
bool escape_quotes) {
|
||||
string dst;
|
||||
string::const_iterator src;
|
||||
|
||||
@ -897,6 +898,8 @@ escape_xml(const string &source) {
|
||||
dst += ">";
|
||||
else if (*src == '<')
|
||||
dst += "<";
|
||||
else if (escape_quotes && (*src == '"'))
|
||||
dst += """;
|
||||
else
|
||||
dst += *src;
|
||||
src++;
|
||||
|
@ -225,7 +225,7 @@ string MTX_DLL_API join(const char *pattern, vector<string> &strings);
|
||||
void MTX_DLL_API strip(string &s, bool newlines = false);
|
||||
void MTX_DLL_API strip(vector<string> &v, bool newlines = false);
|
||||
string MTX_DLL_API escape(const string &src);
|
||||
string MTX_DLL_API escape_xml(const string &src);
|
||||
string MTX_DLL_API escape_xml(const string &src, bool escape_quotes = false);
|
||||
string MTX_DLL_API unescape(const string &src);
|
||||
bool MTX_DLL_API starts_with(const string &s, const char *start,
|
||||
int maxlen = -1);
|
||||
|
Loading…
Reference in New Issue
Block a user