Skip to content

Commit

Permalink
🐛 fix escape
Browse files Browse the repository at this point in the history
  • Loading branch information
XiYang6666 committed Jul 23, 2024
1 parent 169054c commit 69f03e2
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ object EscapeUtil {
.replace(""", "\"")
.replace("&lt;", "<")
.replace("&gt;", ">")
.replace("&amp", "&")
.replace("&amp;", "&")
val regex = Regex("""&#(x?[0-9]+);""")
return regex.replace(processedString) {
val numStr = it.groupValues[1]
Expand All @@ -16,7 +16,7 @@ object EscapeUtil {
}

fun unescape(string: String) = string
.replace("&", "&amp")
.replace("&", "&amp;")
.replace("\"", "&quot;")
.replace("<", "&lt;")
.replace(">", "&gt;")
Expand Down

0 comments on commit 69f03e2

Please sign in to comment.