fcl-js: jswriter: write #$ff00..#$ffff as \u

git-svn-id: trunk@40080 -
This commit is contained in:
Mattias Gaertner 2018-10-29 16:41:22 +00:00
parent a71dc667ce
commit 3b6436ffe1
2 changed files with 4 additions and 3 deletions

View File

@ -498,7 +498,7 @@ begin
TokenStart := TokenStr;
repeat
Inc(TokenStr);
If (TokenStr[0]='\') and (TokenStr[1]='u') then
//If (TokenStr[0]='\') and (TokenStr[1]='u') then
until not (TokenStr[0] in ['A'..'Z', 'a'..'z', '0'..'9', '_','$']);
Len:=(TokenStr-TokenStart);
SetLength(FCurTokenString,Len);

View File

@ -533,7 +533,7 @@ function TJSWriter.EscapeString(const S: TJSString; Quote: TJSEscapeQuote
Var
I,J,L : Integer;
R: TJSString;
c: Char;
c: WideChar;
begin
I:=1;
@ -543,7 +543,7 @@ begin
While I<=L do
begin
c:=S[I];
if (c in [#0..#31,'"','''','/','\']) then
if (c in [#0..#31,'"','''','/','\']) or (c>=#$ff00) then
begin
R:=R+Copy(S,J,I-J);
Case c of
@ -557,6 +557,7 @@ begin
#10 : R:=R+'\n';
#12 : R:=R+'\f';
#13 : R:=R+'\r';
#$ff00..#$ffff: R:=R+'\u'+TJSString(HexStr(ord(c),4));
end;
J:=I+1;
end;