浏览代码

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

git-svn-id: trunk@47829 -
Mattias Gaertner 4 年之前
父节点
当前提交
049af48bd8
共有 1 个文件被更改,包括 3 次插入4 次删除
  1. 3 4
      packages/fcl-js/src/jswriter.pp

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

@@ -611,10 +611,9 @@ begin
               begin
               inc(I,2); // surrogate, two char codepoint
               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
           else
             // invalid UTF-16 at end of string, cannot be encoded as UTF-8 -> encode as hex