mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:37:34 +00:00
LibJS: Use a Utf8View on the subject if the regex has the unicode flag
This makes LibRegex behave (more) correctly with regards to matching unicode code points.
This commit is contained in:
parent
f364fcec5d
commit
c85ab623c0
1 changed files with 6 additions and 1 deletions
|
@ -240,7 +240,12 @@ static Value regexp_builtin_exec(GlobalObject& global_object, RegExpObject& rege
|
|||
}
|
||||
|
||||
regex.start_offset = last_index;
|
||||
result = regex.match(string);
|
||||
// FIXME: JavaScript strings are UTF-16, update this if the backing storage
|
||||
// encoding changes for spec compliance reasons.
|
||||
if (unicode)
|
||||
result = regex.match(Utf8View { string });
|
||||
else
|
||||
result = regex.match(string);
|
||||
|
||||
if (result.success)
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue