From a7f0846a6bda8ec789288f1ed3db2d6d82a72322 Mon Sep 17 00:00:00 2001 From: Bojidar Marinov Date: Wed, 23 Sep 2015 21:33:31 +0300 Subject: [PATCH 1/2] Flip < and > in String::xml_escape. Close #2511 Before > referred to < and < to >, which is incorrect... --- core/ustring.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/ustring.cpp b/core/ustring.cpp index ff7c8984fad..f6d8e6c1fe6 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -3119,8 +3119,8 @@ String String::xml_escape(bool p_escape_quotes) const { String str=*this; str=str.replace("&","&"); - str=str.replace("<",">"); - str=str.replace(">","<"); + str=str.replace("<","<"); + str=str.replace(">",">"); if (p_escape_quotes) { str=str.replace("'","'"); str=str.replace("\"","""); From ca11b2fa4b87642d6e1bbd000bfa74e4922b390b Mon Sep 17 00:00:00 2001 From: Bojidar Marinov Date: Wed, 23 Sep 2015 21:40:24 +0300 Subject: [PATCH 2/2] Fix _xml_unescape, as suggested by @reduz --- core/ustring.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/ustring.cpp b/core/ustring.cpp index f6d8e6c1fe6..e5419effcb9 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -3172,12 +3172,12 @@ static _FORCE_INLINE_ int _xml_unescape(const CharType *p_src,int p_src_len,Char } else if (p_src_len>=4 && p_src[1]=='g' && p_src[2]=='t' && p_src[3]==';') { if (p_dst) - *p_dst='<'; + *p_dst='>'; eat=4; } else if (p_src_len>=4 && p_src[1]=='l' && p_src[2]=='t' && p_src[3]==';') { if (p_dst) - *p_dst='>'; + *p_dst='<'; eat=4; } else if (p_src_len>=5 && p_src[1]=='a' && p_src[2]=='m' && p_src[3]=='p' && p_src[4]==';') {