2
0
Эх сурвалжийг харах

* the code page of unicodestring/widestring on big endian targets is
UTF-16BE, not UTF-16LE

git-svn-id: trunk@21255 -

Jonas Maebe 13 жил өмнө
parent
commit
ab914a8ae3

+ 2 - 1
compiler/globals.pas

@@ -104,7 +104,8 @@ interface
 {$endif FPC_LITTLE_ENDIAN}
 {$endif}
        CP_UTF8 = 65001;
-       CP_UTF16 = 1200;
+       CP_UTF16LE = 1200;
+       CP_UTF16BE = 1201;
        CP_NONE  = 65535;
 
 

+ 12 - 3
compiler/symdef.pas

@@ -1686,7 +1686,10 @@ implementation
       begin
          inherited create(stringdef);
          stringtype:=st_widestring;
-         encoding:=CP_UTF16;
+         if target_info.endian=endian_little then
+           encoding:=CP_UTF16LE
+         else
+           encoding:=CP_UTF16BE;
          len:=-1;
          savesize:=sizeof(pint);
       end;
@@ -1696,7 +1699,10 @@ implementation
       begin
          inherited ppuload(stringdef,ppufile);
          stringtype:=st_widestring;
-         encoding:=CP_UTF16;
+         if target_info.endian=endian_little then
+           encoding:=CP_UTF16LE
+         else
+           encoding:=CP_UTF16BE;
          len:=ppufile.getaint;
          savesize:=sizeof(pint);
       end;
@@ -1706,7 +1712,10 @@ implementation
       begin
          inherited create(stringdef);
          stringtype:=st_unicodestring;
-         encoding:=CP_UTF16;
+         if target_info.endian=endian_little then
+           encoding:=CP_UTF16LE
+         else
+           encoding:=CP_UTF16BE;
          len:=-1;
          savesize:=sizeof(pint);
       end;