[Lazarus] -FcUTF8,-dEnableUTF8 create problem

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Feb 19 10:44:03 CET 2015


On Thu, 19 Feb 2015 10:30:48 +0200
FreeMan <freeman35 at delphiturkiye.com> wrote:

> osx fpc & lazarus svn QT x64
> my project's Compiler options has
> -FcUTF8

This changes the $codepage.

> -dEnableUTF8

This has no effect on UTF8 Linux.

 
> this is my code: this code work normal without ut8 params

Is this an LCL application?

 
> const
>    WIN_EXE: String = 'MZ';
>    LINUX_EXE: String = #127 + 'ELF';

What is string? AnsiString?

> var
>    wFileStr: TFileStream;
>    ar: array[0..4] of byte;
>    ExecType: char;
>   wProgram := ParamStrUTF8(0);
>   wFileStr := TFileStream.Create(wProgram, fmOpenRead);
>   try
>     wFileStr.Read(ar, 4); *--> problem is here ar array all Item is 0, 
> test width string, its return nil*
>   Finally
>     wFileStr.Free;
>   end;
>   if CompareMem(@(ar), Pchar(WIN_EXE), 2) then ExecType := 'W'
>   else if CompareMem(@(ar), Pchar(LINUX_EXE), 4) then ExecType := 'L'
>        else Exit;

 
Mattias




More information about the Lazarus mailing list