mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-02 03:50:35 +02:00
pas2js: skip invalid surrogate
This commit is contained in:
parent
6bb5c3c48c
commit
bb817db47a
@ -6780,7 +6780,7 @@ var
|
|||||||
else break;
|
else break;
|
||||||
end;
|
end;
|
||||||
if Result>$10ffff then
|
if Result>$10ffff then
|
||||||
RaiseNotYetImplemented(20170207164657,El,'maximum codepoint is $10ffff');
|
Err(20170207164657);
|
||||||
inc(p);
|
inc(p);
|
||||||
end;
|
end;
|
||||||
if p=StartP then
|
if p=StartP then
|
||||||
@ -6859,7 +6859,8 @@ begin
|
|||||||
if (j>=$DC00) and (j<$DFFF) then
|
if (j>=$DC00) and (j<$DFFF) then
|
||||||
Result:=Result+CodePointToJSString((i and $3FF) shl 10 + (j and $3ff) + $10000)
|
Result:=Result+CodePointToJSString((i and $3FF) shl 10 + (j and $3ff) + $10000)
|
||||||
else
|
else
|
||||||
Err(20231017120034);
|
// invalid surrogate -> write as two \u
|
||||||
|
Result:=Result+CodePointToJSString(i)+CodePointToJSString(j)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Result:=Result+CodePointToJSString(i);
|
Result:=Result+CodePointToJSString(i);
|
||||||
|
Loading…
Reference in New Issue
Block a user