Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.0.1
-
None
Description
to escape Html tags, "<" is replaced with "& lt;" and ">" is replaced with "& gt;".
However, when there is no "<" preceding a ">", the ">" should NOT be replaced by " & gt;".
"<b>" will be correctly converted to "& lt;b& gt;"
">test" will be INCORRECTLY converted to "& gt;test" as html will display it as "& gt;test" instead of ">test"
currently, i circumvent this problem by doing the following:
QString line; ... if(line.indexOf("<",0)<line.indexOf(">",0)) { line.replace("<","& lt;"); } else { line.replace("<","& lt;");line.replace(">","& gt;"); }
also, i had to type a space in between the "&" and "gt;" for this bugreport, because otherwise they would be displayed incorrectly.