IDE: write UTF-16 values to "value" chunk of LRJ file

git-svn-id: trunk@52688 -
This commit is contained in:
maxim 2016-07-14 21:02:45 +00:00
parent e1e9df010b
commit 3f249dd4c1

View File

@ -4851,17 +4851,18 @@ end;
function TTranslateStrings.GetValue(const S: string): string;
var
i, l: Integer;
jsonstr: string;
jsonstr: unicodestring;
begin
Result:='';
jsonstr:=StringToJSONString(S);
//input string is assumed to be in UTF-8 encoding
jsonstr:=UTF8ToUTF16(StringToJSONString(S));
l:=Length(jsonstr);
for i:=1 to l do
begin
if (Ord(jsonstr[i])<32) or (Ord(jsonstr[i])>=127) then
Result:=Result+'\u'+HexStr(Ord(jsonstr[i]), 4)
else
Result:=Result+jsonstr[i];
Result:=Result+Char(jsonstr[i]);
end;
end;