[Lazarus] FPC 2.7.1 and console output

Hans-Peter Diettrich DrDiettrich1 at aol.com
Wed Dec 3 16:06:28 CET 2014


Mattias Gaertner schrieb:
> On Tue, 02 Dec 2014 22:41:04 +0100
> Hans-Peter Diettrich <DrDiettrich1 at aol.com> wrote:

>> Next I tried FP, but couldn't figure out how to configure it at all, for 
>> using the trunk compiler :-(
> 
> Do you mean in Lazarus?

No, the FP IDE. It has become almost useless, most options are read-only :-(


>>> What do you mean with "string output"?
>> WriteLn to the console.
> 
> Beware that if you want to test string encoding, console is deceiving.
> Input and output.

Until now wrong console output indicated a problem with the encoding of 
the strings to output -  that's what I want to know, for further test. 
Otherwise the conversion to the actual console CP is working, because 
the fpc_Write_Text_xyz routines use RawByteString arguments, so that 
they have to check the dynamic string encoding. Ordinary subroutines, 
that use other string argument types, will almost produce random 
results, because AnsiStrings tend to have a dynamic encoding different 
from the expected (static) encoding. I wonder when this flaw will be 
fixed :-(

> You can use your current codepage as source encoding, or use UTF-8
> sources and function UTF8ToConsole for x-platform. The latter is
> does not magically extend the limitations of the console, but at
> least other people can read your sources and you can use your code
> with the LCL.

Using UTF-8 sources *and* {$codepage UTF8} cures the unusable CP_ACP 
encoding of string literals, they are converted as expected in immediate 
output or when assigned to any AnsiString. Other settings cannot work 
with the current handling of AnsiString :-(

DoDi





More information about the Lazarus mailing list