Merge pull request #13739 from t-inu/issue13500

Add processing to remove duplicated escape characters
pull/14249/head
Sharif Elgamal 2022-05-31 12:07:30 -07:00 committed by GitHub
commit f77209d23c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -355,6 +355,12 @@ func checkString(s string) string {
}
}
// Remove unnecessary backslashes
if s[0] == '"' {
r := strings.NewReplacer(`\\`, "\\", `\a`, "\a", `\b`, "\b", `\f`, "\f", `\n`, "\n", `\r`, "\r", `\t`, "\t", `\v`, "\v", `\"`, "\"")
stringToTranslate = r.Replace(stringToTranslate)
}
// Hooray, we can translate the string!
return stringToTranslate
}