LCL: LoadFromCSVStream: fixed converting UTF16

git-svn-id: trunk@50146 -
This commit is contained in:
mattias 2015-10-22 21:34:53 +00:00
parent bb0313a2d6
commit fcafecec98

View File

@ -163,7 +163,7 @@ var
procedure ConvertEncoding;
var
Pw: PWidechar;
W: WideString;
begin
if (CSVEncoding=ceAuto) and (BufLen>1) then begin
if (leadPtr[0]=#$FF) and (leadPtr[1]=#$FE) then begin
@ -192,9 +192,11 @@ var
begin
if CSVEncoding=ceUTF16be then
ConvertToUTF16;
Pw := pointer(leadPtr);
Buffer := UTF8Encode(widestring(Pw));
SetLength(W,(tailPtr-leadPtr) div 2 +1);
System.Move(leadPtr^,W[1],length(W));
Buffer := UTF8Encode(W);
leadPtr := @Buffer[1];
BufLen := length(Buffer);
end;
end;
end;