pas2js: skip invalid surrogate

This commit is contained in:
mattias 2023-10-17 13:11:09 +02:00
parent 6bb5c3c48c
commit bb817db47a

View File

@ -6780,7 +6780,7 @@ var
else break;
end;
if Result>$10ffff then
RaiseNotYetImplemented(20170207164657,El,'maximum codepoint is $10ffff');
Err(20170207164657);
inc(p);
end;
if p=StartP then
@ -6859,7 +6859,8 @@ begin
if (j>=$DC00) and (j<$DFFF) then
Result:=Result+CodePointToJSString((i and $3FF) shl 10 + (j and $3ff) + $10000)
else
Err(20231017120034);
// invalid surrogate -> write as two \u
Result:=Result+CodePointToJSString(i)+CodePointToJSString(j)
end
else
Result:=Result+CodePointToJSString(i);