mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-05 16:14:38 +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:
committed by
Ali Mohammad Pur
parent
f364fcec5d
commit
c85ab623c0
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user