mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 20:39:14 +02:00
LCL: LoadFromCSVStream: fixed converting UTF16
git-svn-id: trunk@50146 -
This commit is contained in:
parent
bb0313a2d6
commit
fcafecec98
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user