Browse Source

* Patch from Bart Broersma for issue ID #38622

git-svn-id: trunk@48962 -
michael 4 years ago
parent
commit
2aab9b1f9b
2 changed files with 4 additions and 0 deletions
  1. 1 0
      packages/fcl-json/src/fpjson.pp
  2. 3 0
      packages/fcl-json/tests/testjsondata.pp

+ 1 - 0
packages/fcl-json/src/fpjson.pp

@@ -1014,6 +1014,7 @@ begin
                 if (U1<>0) then
                   begin
                   App:={$IFDEF FPC_HAS_CPSTRING}UTF8Encode({$ENDIF}WideChar(U1)+WideChar(U2){$IFDEF FPC_HAS_CPSTRING}){$ENDIF};
+                  U1:=0;
                   U2:=0;
                   end
                 else

+ 3 - 0
packages/fcl-json/tests/testjsondata.pp

@@ -4077,6 +4077,9 @@ begin
   TestFrom('\u00f8','ø'); // this is ø
   TestFrom('\u00f8\"','ø"'); // this is ø"
   TestFrom('\ud83c\udf1f',GlowingStar);
+  TestFrom('\u0041\u0042','AB');   //issue #0038622
+  TestFrom('\u0041\u0042\u0043','ABC');
+  TestFrom('\u0041\u0042\u0043\u0044','ABCD');
 end;
 
 procedure TTestJSONString.TestStringToJSONString;