[Lazarus] FPC 2.7.1 and console output

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Dec 4 16:53:07 CET 2014


On Thu, 04 Dec 2014 16:06:48 +0100
Hans-Peter Diettrich <DrDiettrich1 at aol.com> wrote:

>[...] Mattias Gaertner schrieb:
> > On Thu, 04 Dec 2014 07:00:59 +0100
> > Hans-Peter Diettrich <DrDiettrich1 at aol.com> wrote:
> 
> > UTF8Console is needed, when your source is UTF-8, but the compiler
> > thinks it is Windows CP. UTF8Console is defined in LazUTF8.
> > An alternative is UTF8Decode.
> 
> Thanks :-)
> 
> >> Just tested on WinXP:
> >>
> >> program test;
> >> var a: AnsiString;
> >> begin
> >>    a := 'äöü';
> >>    WriteLn(a,'äöü');
> >> end;
> >>
> >> works differently with file encoding Ansi, UTF-8 and UTF-8bom. The 
> >> latter correctly shows 'äöüäöü', else a mix of several encodings shows 
> >> up in the console.
> > 
> > I see.
> 
> Only after testing the string encodings I found out that $codepage does 
> not affect CP_ACP, this was unclear to me before. A new Lazarus version 
> instead may try to set DefaultSystemCodePage to UTF-8, in order to 
> preserve compatibility with the current assumption about UTF-8 encoding 
> with AnsiStrings.

Yes, this fixes many problems. OTOH it create some new
(e.g. ThousandSeparator).

 
> > Indeed I never tried passing a constant in writeln.
> 
> You never wrote text or separtors?

I meant my tests with fpc 2.7.1. ;)


> > Does Delphi also pass constants unconverted to writeln?
> 
> Delphi does not convert anything in console output, the user must 
> convert everything to CP_OEM :-(

Same as fpc 2.6.4.
What function do Delphians use?

Mattias




More information about the Lazarus mailing list