mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 06:09:14 +02:00
lazutils: fix use of ut8string
git-svn-id: trunk@33383 -
This commit is contained in:
parent
4ca8f0c158
commit
d9a1e19722
@ -175,7 +175,7 @@ begin
|
|||||||
// Fix for the bug 14360:
|
// Fix for the bug 14360:
|
||||||
// Don't assign the widestring to TSearchRec.name because it is of type
|
// Don't assign the widestring to TSearchRec.name because it is of type
|
||||||
// string, which will generate a conversion to the system encoding
|
// string, which will generate a conversion to the system encoding
|
||||||
Str := UTF8Decode(Filename);
|
Str := Utf8ToAnsi(Filename);
|
||||||
FindHandle:=Windows.FindFirstFileA(PAnsiChar(Str), FindData);
|
FindHandle:=Windows.FindFirstFileA(PAnsiChar(Str), FindData);
|
||||||
if FindHandle=Windows.Invalid_Handle_value then
|
if FindHandle=Windows.Invalid_Handle_value then
|
||||||
begin
|
begin
|
||||||
@ -262,20 +262,20 @@ end;
|
|||||||
See FindMatch also }
|
See FindMatch also }
|
||||||
procedure FindWideToAnsi(const wide: TWIN32FINDDATAW; var ansi: TWIN32FINDDATA);
|
procedure FindWideToAnsi(const wide: TWIN32FINDDATAW; var ansi: TWIN32FINDDATA);
|
||||||
var
|
var
|
||||||
ws : WideString;
|
ws: WideString;
|
||||||
an : utf8string;
|
an: AnsiString;
|
||||||
begin
|
begin
|
||||||
{$ifdef WinCE}
|
{$ifdef WinCE}
|
||||||
ansi := wide;
|
ansi := wide;
|
||||||
{$else}
|
{$else}
|
||||||
SetLength(ws, length(wide.cAlternateFileName));
|
SetLength(ws, length(wide.cAlternateFileName));
|
||||||
Move(wide.cAlternateFileName[0], ws[1], length(ws)*2);
|
Move(wide.cAlternateFileName[0], ws[1], length(ws)*2);
|
||||||
an:=ws; // no need to utf8 for cAlternateFileName (it's always ansi encoded)
|
an := AnsiString(ws); // no need to utf8 for cAlternateFileName (it's always ansi encoded)
|
||||||
Move(an[1], ansi.cAlternateFileName, sizeof(ansi.cAlternateFileName));
|
Move(an[1], ansi.cAlternateFileName, sizeof(ansi.cAlternateFileName));
|
||||||
|
|
||||||
ws:=PWideChar(@wide.cFileName[0]);
|
ws := PWideChar(@wide.cFileName[0]);
|
||||||
an:=UTF8Encode(ws);
|
an := UTF8Encode(ws);
|
||||||
ansi.cFileName:=an;
|
ansi.cFileName := an;
|
||||||
if length(an)<length(ansi.cFileName) then ansi.cFileName[ length(an)]:=#0;
|
if length(an)<length(ansi.cFileName) then ansi.cFileName[ length(an)]:=#0;
|
||||||
|
|
||||||
with ansi do
|
with ansi do
|
||||||
|
Loading…
Reference in New Issue
Block a user