[fpc-devel] Delphi incompatible encoding

2014-12-01 Thread Hans-Peter Diettrich
Now I could compile FPC 2.7.1 and perform some tests :-) Unfortunately I couldn't submit an bug report, so it comes here: When compiled with Delphi XE, the code below shows 1252 (my DefaultSystemCodePage) for all strings, be empty or non-empty. Compiled with FPC 2.7.1, the StringCodePage(r) is

Re: [fpc-devel] Delphi incompatible encoding

2014-12-01 Thread Sven Barth
Am 01.12.2014 10:33 schrieb "Hans-Peter Diettrich" : > Another one: > Delphi XE does not export the CP_xxx encoding constants from System.pas. This means that the encoding constants are not available in (compatible) user code. It's not the first and likely not the last we export from a different u

Re: [fpc-devel] Delphi incompatible encoding

2014-12-01 Thread Jonas Maebe
Hans-Peter Diettrich wrote on ma, 01 dec 2014: Now I could compile FPC 2.7.1 and perform some tests :-) Unfortunately I couldn't submit an bug report, so it comes here: When compiled with Delphi XE, the code below shows 1252 (my DefaultSystemCodePage) for all strings, be empty or non-empty.

Re: [fpc-devel] Delphi incompatible encoding

2014-12-01 Thread Jonas Maebe
Hans-Peter Diettrich wrote on ma, 01 dec 2014: program rawtest; var s: AnsiString; //UTF8String; r: RawByteString; begin s := 'abc'; r := s; WriteLn('s CP: ',StringCodePage(s)); //1252 I forgot to mention that the above also prints 0 in FPC if you don't compile in mode delphiunico

Re: [fpc-devel] Delphi incompatible encoding

2014-12-01 Thread Hans-Peter Diettrich
Sven Barth schrieb: Am 01.12.2014 10:33 schrieb "Hans-Peter Diettrich" >: > Another one: > Delphi XE does not export the CP_xxx encoding constants from System.pas. This means that the encoding constants are not available in (compatible) user code. It's not the f

Re: [fpc-devel] Delphi incompatible encoding

2014-12-01 Thread Hans-Peter Diettrich
Jonas Maebe schrieb: Hans-Peter Diettrich wrote on ma, 01 dec 2014: To get behaviour that is compatible with Delphi2009+, compile with -Mdelphiunicode or {$modeswitch delphiunicode}. The compiler option (-M) works, but the $modeswitch is not accepted by the compiler (2.7.1): Illegal compil

Re: [fpc-devel] Delphi incompatible encoding

2014-12-01 Thread Sven Barth
On 02.12.2014 00:01, Hans-Peter Diettrich wrote: Sven Barth schrieb: Am 01.12.2014 10:33 schrieb "Hans-Peter Diettrich" mailto:drdiettri...@aol.com>>: > Another one: > Delphi XE does not export the CP_xxx encoding constants from System.pas. This means that the encoding constants are not availa

Re: [fpc-devel] Delphi incompatible encoding

2014-12-01 Thread Hans-Peter Diettrich
Jonas Maebe schrieb: To get behaviour that is compatible with Delphi2009+, compile with -Mdelphiunicode or {$modeswitch delphiunicode}. Do you mean {$mode delphiunicode}? Now I wonder about compilation at all. When I compile a console program on the commandline, most strings are readable in

Re: [fpc-devel] Delphi incompatible encoding

2014-12-02 Thread Tomas Hajny
On Tue, December 2, 2014 08:31, Hans-Peter Diettrich wrote: > Jonas Maebe schrieb: > >> To get behaviour that is compatible with Delphi2009+, compile with >> -Mdelphiunicode or {$modeswitch delphiunicode}. > > Do you mean {$mode delphiunicode}? > > Now I wonder about compilation at all. > When I co

Re: [fpc-devel] Delphi incompatible encoding

2014-12-02 Thread Mattias Gaertner
On Tue, 02 Dec 2014 04:05:59 +0100 Hans-Peter Diettrich wrote: > Jonas Maebe schrieb: > > > > Hans-Peter Diettrich wrote on ma, 01 dec 2014: > > > To get behaviour that is compatible with Delphi2009+, compile with > > -Mdelphiunicode or {$modeswitch delphiunicode}. > > The compiler option (-M

Re: [fpc-devel] Delphi incompatible encoding

2014-12-02 Thread Mattias Gaertner
On Tue, 2 Dec 2014 09:18:29 +0100 "Tomas Hajny" wrote: >[...] > Probably best to ask about the wrong behaviour with Lazarus on a Lazarus > list? Otherwise: In what format (encoding) is your source file? Unless > it's a UTF-8 with BOM, FPC decodes it according to the -Fc parameter and > Lazarus ma

Re: [fpc-devel] Delphi incompatible encoding

2014-12-02 Thread Mattias Gaertner
On Tue, 02 Dec 2014 04:05:59 +0100 Hans-Peter Diettrich wrote: >[...] > BTW it's nice that FPC console Write/Ln (mostly) converts AnsiStrings to > the console codepage, while Delphi (XE) doesn't convert :-) +1 Although it confuses people who don't know about "console codepage" (OEM codepage).

Re: [fpc-devel] Delphi incompatible encoding

2014-12-02 Thread Hans-Peter Diettrich
Tomas Hajny schrieb: On Tue, December 2, 2014 08:31, Hans-Peter Diettrich wrote: When I compile a console program on the commandline, most strings are readable in the console (see previous answer). But when I compile using Lazarus, all strings (including UnicodeString!) are shown in unreadable

Re: [fpc-devel] Delphi incompatible encoding

2014-12-02 Thread Hans-Peter Diettrich
Mattias Gaertner schrieb: On Tue, 02 Dec 2014 04:05:59 +0100 Hans-Peter Diettrich wrote: Many things affect string literals. Source codepage, system codepage, string type, defaultsystemcodepage, library, compiler version. I started a table for UTF-8 literals: http://wiki.lazarus.freepascal.o

Re: [fpc-devel] Delphi incompatible encoding

2014-12-02 Thread Mattias Gaertner
On Tue, 02 Dec 2014 11:32:13 +0100 Hans-Peter Diettrich wrote: > Mattias Gaertner schrieb: > > On Tue, 02 Dec 2014 04:05:59 +0100 > > Hans-Peter Diettrich wrote: > > > Many things affect string literals. Source codepage, system codepage, > > string type, defaultsystemcodepage, library, compiler