[Lazarus] FPC 2.7.1 and console output

Mattias Gaertner nc-gaertnma at netcologne.de
Tue Dec 2 13:41:58 CET 2014


On Tue, 02 Dec 2014 11:21:43 +0100
Hans-Peter Diettrich <DrDiettrich1 at aol.com> wrote:

> First I thank the Lazarus team for the fine 1.3 version, usable for 
> development with FPC trunk (Unicode version). In detail the greyed-out 
> branches in conditional compilation sections are very helpful when 
> inspecting the RTL units :-)

Thanks.
Keep in mind that the IDE does not know all flags, so maybe some
highlights are wrong. Although so far no one has complained, so it
seems to work pretty well.


> On my first steps with the Unicode RTL I found a different behaviour, 
> when a console program is compiled from an PAS file, and from an LPI/LPR 
> project. [on WinXP, Ansi source files]

What do you mean with "compiled from an PAS file"?

You can see what parameters the IDE passed to the compiler. Right click
on the messages (e.g. the "Compile Project..."), then "About Compiler
Project...".

 
> When compiled from an PAS file, the behaviour is identical to the direct 
> compilation on the commandline, string output is readable.
> 
> When compiled from an LPR file (LPI project), the string output has 
> unreadable UTF-8 encoding, even for UnicodeString. Did I miss some 
> project setting, required for proper console output?

Have you set any flags in the "Configure Build Lazarus" dialog?

What do you mean with "string output"? 
In the LCL form?
In the console from writeln?
In the console from debugln?
In a file?

LCL and debugln expect UTF-8, writeln needs DefaultSystemCodePage in
FPC 2.7.1 and file is a broad category.

 
> When I try {$codepage 1252}, I get an error during compilation ("file 
> not open")? The "charset" unit, mentioned in help on $codepage, doesn't 
> give any clues about allowed values. What's the correct value for 
> Windows default (western)?

{$codepage cp1252}

> Or how else can I establish a global default sourcecode codepage?

If you mean with "global" your project: Add -FcCP1252 to the custom
compiler options.


Mattias




More information about the Lazarus mailing list