mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-27 07:30:09 +02:00
LazUtils: improve unicode path/filename handling by Fileutil.ReadFileToString, patch from Takeda Matsuki, bug #22953
git-svn-id: trunk@38816 -
This commit is contained in:
parent
984207646b
commit
9a487a2e50
@ -1543,15 +1543,15 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
function ReadFileToString(const Filename: String): String;
|
||||
var
|
||||
fs: TFileStream;
|
||||
fs: TFileStreamUTF8;
|
||||
begin
|
||||
Result := '';
|
||||
try
|
||||
fs := TFileStream.Create(UTF8ToSys(Filename), fmOpenRead or fmShareDenyWrite);
|
||||
fs := TFileStreamUTF8.Create(Filename, fmOpenRead or fmShareDenyWrite);
|
||||
try
|
||||
Setlength(Result, fs.Size);
|
||||
if Result <> '' then
|
||||
fs.Read(Result[1], Length(Result));
|
||||
fs.Read(Result[1], UTF8Length(Result));
|
||||
finally
|
||||
fs.Free;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user