* * *

Author Topic: Fatal: illegal character "'($C2)  (Read 2138 times)

ThierryJ

  • New member
  • *
  • Posts: 16
Fatal: illegal character "'($C2)
« on: July 01, 2018, 11:19:00 am »
Hello everybody,

I am using Lazarus in an Ubuntu 16.04 LTS virtual machine running in Parallels Version 13.3.2 (43368) on a Mac...

I used to write my Pascal code with spaces in sentences, such as a + b := c, or FCodeIso : Integer;

In my configuration, when compiling, I get quite often this error message :

PascalSourceFile.pas(position) Fatal: illegal character "'($C2).


Before the ($C2) indication, there is a strange character like FF in a box on top on another unreadable character code.
I cannot determine what makes this error appear, because in the previous exemple the error may occur on either or neither of the "space" character I used. It seems that the error appear more often around the := operator, either in left or right position. But it is sometimes present in the declaration part of the code (I : Integer), and so on.

I have made a check with the latest Mint distribution running in Parallels on a Mac, and the error is also present. Lazarus is the only software I use presenting this behavior in my Virtual machines. I have detected this problem maybe years ago, with earlier versions of Lazarus, but now it is still present and I wish to use the EDI for playing around instead of Delphi.

Could someone give me a clue about this ?

Thanks in advance, best regards,

Thierry

Thaddy

  • Hero Member
  • *****
  • Posts: 7130
Re: Fatal: illegal character "'($C2)
« Reply #1 on: July 01, 2018, 01:11:38 pm »
$C2 (194 dec) is above 127. Sourcecode can not contain characters above Ascii 127 unless it is the conten of a a string  or var or const.
I.E: you can not use characters above ASCII 127 in your Pascal sources, but you can use it in a string or char  or const:string.
Also, $C2 has a different meaning depending on code page.
The compiler will show you exactly on which line and which position the culprit is.
In Western European languages it is usually Latin capital letter A with circumflex (A circonflex) and that is not allowed in Pascal code. Only for strings and chars as content, not even as variable name..
See https://www.ascii-code.com/
Pascal sourcecode (the language) itself is strictly limited to characters from 0..127 but the content of its variables are not (char, string)
BTW doesn't depend on OS or platform.
« Last Edit: July 01, 2018, 01:26:52 pm by Thaddy »
inline variables like in D10.3 are a bit like Brexit: if you are given the wrong information it sounds like a good idea. Every kid loves candy, but it makes you fat and your teeth will disappear.

ThierryJ

  • New member
  • *
  • Posts: 16
Re: Fatal: illegal character "'($C2)
« Reply #2 on: July 01, 2018, 08:19:11 pm »
Thank you for your answer, but I know all of this. My question is : How comes that when I type in a Space (Chr 32) it ends sometimes with this strange codification ? I can insure you that I enter my code as usual, and that I have a HUGE typing experience, having been a COBOL developer for years...

Please note also that there is no real rule, sometimes it appears, sometimes not, in different contexts, in the procedural part as well as in the declarations. The only constant I see is that it replaces the space I entered, no other character.


Handoko

  • Hero Member
  • *****
  • Posts: 2636
  • My goal: build my own game engine using Lazarus
Re: Fatal: illegal character "'($C2)
« Reply #3 on: July 01, 2018, 08:23:31 pm »
Have you tried different versions of Lazarus on it?

fred

  • Full Member
  • ***
  • Posts: 118
Re: Fatal: illegal character "'($C2)
« Reply #4 on: July 01, 2018, 08:48:06 pm »
Not sure if it's the same, I think is had something similar on xubuntu , is tought it was when typing a quote ' it made a different quote.
Or perhaps I copied some source code, don't know anymore...
I copied another quote to paste at the right places, wanted to look into this but forgot about it since it was just a small test on xubuntu to see if Lazarus would work.
Started with OmegaSoft Pascal on OS-9/68k , now Lazarus 1.8.4 / FPC 3.0.4 on Windows 7

Thaddy

  • Hero Member
  • *****
  • Posts: 7130
Re: Fatal: illegal character "'($C2)
« Reply #5 on: July 01, 2018, 10:31:57 pm »
Well, the only thing I can add is that it is all too easy to type an "A circonflex" on an Azerty keyboard, which I think you have, Thierry....
(When I type computer it comes out as ordinateur... O:-) Just kiddin') I would check my A's first...And clean your monitor first just in case.... :D :D It is not a fly...
« Last Edit: July 01, 2018, 10:38:16 pm by Thaddy »
inline variables like in D10.3 are a bit like Brexit: if you are given the wrong information it sounds like a good idea. Every kid loves candy, but it makes you fat and your teeth will disappear.

mercurhyo

  • Jr. Member
  • **
  • Posts: 76
Re: Fatal: illegal character "'($C2)
« Reply #6 on: July 01, 2018, 10:58:47 pm »
Je ne sais pas ce qu'il fume lui, mais c'est de la bonne
DEO MERCHVRIO - Linux Mint 18, Windows 7 - Laz1.8 - RAD Studio Architect XE7
god of financial gain, commerce, eloquence (and thus poetry), messages, communication (including divination), travelers, boundaries, luck, trickery and thieves; he also serves as the guide of souls to the underworld

mercurhyo

  • Jr. Member
  • **
  • Posts: 76
Re: Fatal: illegal character "'($C2)
« Reply #7 on: July 01, 2018, 11:02:28 pm »
@ThierryJ
if you get such error, can you then save your code file and reopen it with another editor or , at best with an hexadecimal editor, and see what happens in the 3rd party editor?
DEO MERCHVRIO - Linux Mint 18, Windows 7 - Laz1.8 - RAD Studio Architect XE7
god of financial gain, commerce, eloquence (and thus poetry), messages, communication (including divination), travelers, boundaries, luck, trickery and thieves; he also serves as the guide of souls to the underworld

engkin

  • Hero Member
  • *****
  • Posts: 2115
Re: Fatal: illegal character "'($C2)
« Reply #8 on: July 01, 2018, 11:26:41 pm »
The compiler is showing part of the offending character.

U+00A0 No-Break Space is C2 A0 in UTF8.

ThierryJ

  • New member
  • *
  • Posts: 16
Re: Fatal: illegal character "'($C2)
« Reply #9 on: July 02, 2018, 10:46:26 am »
@Handoko. I got this problem at least one year ago, when just playing a Hello World with the then current version.
@Fred : In this case, the problem occurs very frequently. I have been able to build the attached sample at the firs trial.
@Thaddy : No, I am using a Swiss French QWERTZ keyboard, without the uppercase accented A. And I repeat : I am a very good typer. We could do a race if you like it...
@mercuryho : I have attached a PDF showing the Lazarus problem, the Emacs view on the source and the Hex decoding.
@engkin : I know

To be short, I know what I type, I know my system, I know a lot... But I don't know how a keystroke on the space bar becomes a strange unicode codification, sometimes. That is the point. Not what, but why and how.

I was thinking about a helping mechanism in the Lazarus editor that may in some circumstances add or modify a character ? In my far past, I remember such a problem in MMS, a source code management system running under VMS - VAX/AXP/... systems. In this case also we had one strange character appearing randomly in the "make file", we never identify the why... But VMS is far away today !

Notice, once more, I am in a VM running in Parallels, this may have an impact, I don't know.

I will try to setup another VM running in VirtualBox and compare it, who knows ?

Thanks to all, anyway.

Thierry



Handoko

  • Hero Member
  • *****
  • Posts: 2636
  • My goal: build my own game engine using Lazarus
Re: Fatal: illegal character "'($C2)
« Reply #10 on: July 02, 2018, 11:23:13 am »
I use VirtualBox on Linux, running Lazarus on VirtualBox so far is okay for me. Yes, please try it on VirtualBox and please report back the result.

Also, maybe you can test in on Parallels:
Create some simple test programs. The first one, drop a TMemo on the form. And the second one, drop a TSynEdit on the form. Then run the programs. If the issue won't happen on TMemo but it happens on TSynEdit, well ... that's what I'm thinking about.

ThierryJ

  • New member
  • *
  • Posts: 16
Re: Fatal: illegal character "'($C2)
« Reply #11 on: July 02, 2018, 12:03:23 pm »
@Handoko

Thanks for your suggestion, I am going to test with the TMemo and TSynEdit.

Right now, I confirm that the problem is also present in the brand new VirtualBox Ubuntu16.04 LTS VM... It is exactly the same. Moreover, I rewrote the exemple attached in my previous message, the problem is in the exact same location.

Weird.

I go back to my tests...

ThierryJ

  • New member
  • *
  • Posts: 16
Re: Fatal: illegal character "'($C2)
« Reply #12 on: July 02, 2018, 12:25:42 pm »
@Handoko

I have made the test you suggested. One single form, with a TMemo and a TSynEdit, in the VirtualBox VM. I typed in both, separately, character by character, the following :

For i := 0 To High(machin) Do

Than I saved the Lines to separate files and checked both with ghex. Both have the same problem. So, the common denominator is the Mac, now ?

I am lost...

mercurhyo

  • Jr. Member
  • **
  • Posts: 76
Re: Fatal: illegal character "'($C2)
« Reply #13 on: July 02, 2018, 03:27:49 pm »
as suggested above, please configure an Oracle VirtualBox (it is free). Well some say it is slower than VMWare (I did not notice due to my PRO computers).
To be sure that is not the virtualizer software, which brings problems.
Regards.
DEO MERCHVRIO - Linux Mint 18, Windows 7 - Laz1.8 - RAD Studio Architect XE7
god of financial gain, commerce, eloquence (and thus poetry), messages, communication (including divination), travelers, boundaries, luck, trickery and thieves; he also serves as the guide of souls to the underworld

mercurhyo

  • Jr. Member
  • **
  • Posts: 76
Re: Fatal: illegal character "'($C2)
« Reply #14 on: July 02, 2018, 03:35:26 pm »
I use a computer running Linux Mint which is driving an emulated ReactOS, AND another one running W10 which is driving 3 emulated boxes as web servers (2 Ubuntu, 1 W7).
All of them are installed with Oracle VirtualBox and its ADDons. All of them have bidirectional clipboards activated. I did not notice strange keystrokes so far (even at passing texts by clipboards)
I use Laz on W7 and Mint, XE7 on W10
« Last Edit: July 02, 2018, 03:43:30 pm by mercurhyo »
DEO MERCHVRIO - Linux Mint 18, Windows 7 - Laz1.8 - RAD Studio Architect XE7
god of financial gain, commerce, eloquence (and thus poetry), messages, communication (including divination), travelers, boundaries, luck, trickery and thieves; he also serves as the guide of souls to the underworld

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus