1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:47:35 +00:00

LibJS: Correctly handle Unicode characters in JS source text

Also recognize additional white space characters.
This commit is contained in:
davidot 2021-08-14 17:07:47 +02:00 committed by Linus Groh
parent 4d6502de42
commit 47bc72bcf6
6 changed files with 100 additions and 16 deletions

View file

@ -85,8 +85,8 @@ static String escape_regexp_pattern(const RegExpObject& regexp_object)
// FIXME: Check u flag and escape accordingly
pattern.replace("\n", "\\n", true);
pattern.replace("\r", "\\r", true);
pattern.replace(LINE_SEPARATOR, "\\u2028", true);
pattern.replace(PARAGRAPH_SEPARATOR, "\\u2029", true);
pattern.replace(LINE_SEPARATOR_STRING, "\\u2028", true);
pattern.replace(PARAGRAPH_SEPARATOR_STRING, "\\u2029", true);
pattern.replace("/", "\\/", true);
return pattern;
}