mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-27 21:10:28 +02:00
fcl-js: jswriter: write #$ff00..#$ffff as \u
git-svn-id: trunk@40080 -
This commit is contained in:
parent
a71dc667ce
commit
3b6436ffe1
@ -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);
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user