Lazarus
Using the Lazarus IDE => Editor => Topic started by: ThierryJ 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
-
$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.
-
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.
-
Have you tried different versions of Lazarus on it?
-
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.
-
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...
-
Je ne sais pas ce qu'il fume lui, mais c'est de la bonne
-
@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?
-
The compiler is showing part of the offending character.
U+00A0 No-Break Space is C2 A0 in UTF8.
-
@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
-
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.
-
@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...
-
@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...
-
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.
-
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
-
On my PowerBook, Mac OS 10.11.5, running Ubuntu 16.04 LT on VirtualBox, I can not reproduce the error.
Maybe a keyboard malfunction?
-
Maybe a keyboard malfunction?
The OP said the problem only happens when running Lazarus on his Mac, not other software. So it should not be hardware problem.
@ThierryJ
Can you find another Mac machine (maybe borrow from your friend) and test on it?
-
@Thierry
I can not reproduce it on my Mac mini. That is unless I set an A circonflex in the sourcecode on purpose.
The compiler gives me the EXACT line and the EXACT position where I put it (as I wrote before).
Send us a screenshot of what the compiler output is.
-
@Thaddy, try Option+Space
-
@mercurhyo : I have already described it. The behavior is the same.
@Thaddy : I have joined a pdf with screen copies of the problem with a previous message.
@Handoko : You are right. I just checked with another, older Apple keyboard, the problem is the same.
In the mean time I have done another test : I have created a fresh Writer document with LibreOffice and put inside the magical phrase, For i := 0 To High(toto) Do something.
Than I have opened the document package, unpacked the file content.xml and fed it to ghex. Everything is perfect, the spaces are 32...
Than I have restarted a new Lazarus project, a new Unit with a single Class. The problem occurred only once right after the "=" in TMyClass = Class...
Than I have created another Class, and all the spaces following = have been replaced.
The attached file shows this.
Finally I have tried to write the same "Class" in a Windows 10 Virtual Machine, and it works...
To be short, the conflict may be with Lazarus running on Debian with a Swiss French keyboard. But I cannot investigate further, I don't have the skills to do it by myself.
Any idea welcome, thanks all for your time.