[Lazarus] Unicode on Windows

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Apr 9 05:30:12 CEST 2012


On Sat, 7 Apr 2012 23:49:42 -0300
Marcos Douglas <md at delfire.net> wrote:

> Hi,
> 
> Using FPC 2.6.1 and Laz trunk on Windows, there is a better way to not to
> do such codes below?
> 
> Examples
> 1- I'm on the LCL and I have an Edit (edtFileName):
> var
>   lFileName: string;
>   lStrings: TStrings;
> begin
>   lStrings := TStrings.Create;
>   try
>     lFileName := Utf8ToSys(edtFileName.Text);
>     lStrings.SaveToFile(lFileName);
>   finally
>     lStrings.Free;
>   end;
> end;
> 
> 2- If I want to add the path delimiter using an Edit (edtPath)
> var
>   lPath: string;
> begin
>   lPath :=
> SysToUtf8(IncludeTrailingPathDelimiter(Utf8ToSys(edtPath.Directory)));

The path delimiter is the same in all system encodings.

   lPath :=IncludeTrailingPathDelimiter(edtPath.Directory);


>   edtPath.Directory := lPath;
> end;


Mattias




More information about the Lazarus mailing list