Răsfoiți Sursa

fcl-js: writer: fixed writing invalid UTF-16

git-svn-id: trunk@47829 -
Mattias Gaertner 4 ani în urmă
părinte
comite
049af48bd8
1 a modificat fișierele cu 3 adăugiri și 4 ștergeri
  1. 3 4
      packages/fcl-js/src/jswriter.pp

+ 3 - 4
packages/fcl-js/src/jswriter.pp

@@ -611,10 +611,9 @@ begin
               begin
               begin
               inc(I,2); // surrogate, two char codepoint
               inc(I,2); // surrogate, two char codepoint
               continue;
               continue;
-              end
-            else
-              // invalid UTF-16, cannot be encoded as UTF-8 -> encode as hex
-              R:=R+'\u'+TJSString(HexStr(ord(c),4));
+              end;
+            // invalid UTF-16, cannot be encoded as UTF-8 -> encode as hex
+            R:=R+'\u'+TJSString(HexStr(ord(S[i]),4));
             end
             end
           else
           else
             // invalid UTF-16 at end of string, cannot be encoded as UTF-8 -> encode as hex
             // invalid UTF-16 at end of string, cannot be encoded as UTF-8 -> encode as hex