On Wed, May 3, 2017 at 2:43 PM, Mattias Gaertner via Lazarus <lazarus@lists.lazarus-ide.org> wrote: > First it did not compile in Delphi, because of an unsupported inline. I > fix that with an IFDEF FPC.
Right, I had added that after testing with Delphi. The inline looks good to me, don't know why Delphi does not like it. > Then it runs. The output is somewhat hard to interpret as the > Windows console shows many chars as '?' and the writelns do not > explain what it is supposed to show. > The good news is that it works. Yes, I guess it should be a GUI app. The console is the only place in Windows not supporting Unicode still. Damn MS, they have supported Unicode in other APIs and apps for nearly 20 years already. > The bad news is, that it only works because Delphi silently altered > the source file and added the BOM. > Back in Lazarus compiling such a file gives the error: > LazUnicodeTest.lpr(28,10) Error: UTF-8 code greater than 65535 found Äh, I did not test moving it back to Lazarus. Hmmm... why does FPC not understand the BOM? > You are right, that using Unicode with Lazarus only needs a couple of > rules to follow. Sharing code with Delphi adds a few more rules. One valid choice is to edit in Lazarus and copy to Delphi only to be built. I understood Marcos Douglas planned something like that. If code really must be edited in both, how to solve it? This was another complication I did not think about. :( About the couple of rules to follow, I had these in mind: 1. Normally use type "String". 2. Assign a constant always to a type String variable. 3. Use type UnicodeString explicitly for API calls that need it. They are not listed as a short list in wiki. The wiki page is more detailed. Maybe they should be listed as a "Getting started" paragraph. Juha -- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus-ide.org http://lists.lazarus-ide.org/listinfo/lazarus