[Lazarus] Unicode on Windows

Marcos Douglas md at delfire.net
Mon Apr 9 14:04:56 CEST 2012


On Mon, Apr 9, 2012 at 12:30 AM, Mattias Gaertner
<nc-gaertnma at netcologne.de> wrote:
>
> 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

Ops... you're right.
I was confused because IncludeTrailingPathDelimiter is part of RTL and
it not works with UTF8. The code uses Length and Result[l]... so, I
thought this is would be problem.

Well, this problem do not exists, but the names of files etc still a problem.

Marcos Douglas




More information about the Lazarus mailing list