Recent

Author Topic: Strange behaviour of Lazarus.  (Read 5689 times)

Przemyslav

  • New Member
  • *
  • Posts: 44
Strange behaviour of Lazarus.
« on: March 08, 2017, 11:24:21 pm »
Hello everyone :) Today I discovered very strange issue / problem with Lazarus.

I was working on my project and I have some Label, Buttons with Polish letter like "ł, ą, ó, ś...":

https://s8.postimg.org/lohad7wid/before.png

It was all OK. I saved and closed my project. After 30 minutes later I open project and I saw:

https://s8.postimg.org/hqu0nt9p1/aftre.png

Something terrible happened with my font :( Where are my polish letters?

My default Charset is: DEFAULT_CHARSET in properties. Of course after I compiled my project in open exe I have the same problem.

What is going on?


Thaddy

  • Hero Member
  • *****
  • Posts: 14164
  • Probably until I exterminate Putin.
Re: Strange behaviour of Lazarus.
« Reply #1 on: March 09, 2017, 07:33:57 am »
The Lazarus editors themselves are UTF8, but the default_charset is the OS charset. So the project properties are saved in the OS charset (CP_ACP?).
Set the charset to unicode ( or maybe to eastern european) explicitly.
Specialize a type, not a var.

Przemyslav

  • New Member
  • *
  • Posts: 44
Re: Strange behaviour of Lazarus.
« Reply #2 on: March 09, 2017, 09:12:42 pm »
I changed every Label, Memo settings to UNICODE, but I have the same situation.

GAN

  • Sr. Member
  • ****
  • Posts: 370
Re: Strange behaviour of Lazarus.
« Reply #3 on: March 10, 2017, 03:22:16 am »
Hi, what operating system do you use? I had a similar problem.
Lazarus 2.0.8 FPC 3.0.4 Linux Mint Mate 19.3
Zeos 7̶.̶2̶.̶6̶ 7.1.3a-stable - Sqlite 3.32.3 - LazReport

Przemyslav

  • New Member
  • *
  • Posts: 44
Re: Strange behaviour of Lazarus.
« Reply #4 on: March 13, 2017, 10:15:57 pm »
Sorry, It doesn't work also :/ My system is Windows 10 Home x64.

I added my source files. Could you look?

My source / program: http://www112.zippyshare.com/v/OvNofU4L/file.html

Thank you for your help ;) I have no idea what wrong is with this project :/ I uses the newest Lazarus.

Przemek

wp

  • Hero Member
  • *****
  • Posts: 11830
Re: Strange behaviour of Lazarus.
« Reply #5 on: March 13, 2017, 11:00:34 pm »
Your project looks correct. The source files are UTF8 which is correct. What happened during the 30 minutes after you closed the project and before you reopened it again? Did you load source files into another editor which could have corrupted the encoding? If you now edit the label texts to replace the wrong characters and save and reload again do the labels remain correct or are they corrupted again?

Przemyslav

  • New Member
  • *
  • Posts: 44
Re: Strange behaviour of Lazarus.
« Reply #6 on: March 13, 2017, 11:24:36 pm »
Your project looks correct. The source files are UTF8 which is correct. What happened during the 30 minutes after you closed the project and before you reopened it again? Did you load source files into another editor which could have corrupted the encoding? If you now edit the label texts to replace the wrong characters and save and reload again do the labels remain correct or are they corrupted again?

Thanks for looking :)
1. Closed files are OK. But when I want to open them in Lazarus the are changing. For example:

Before - OK files with word: Pikietaż:

Code: Pascal  [Select][+][-]
  1. object Form1: TForm1
  2.   Left = 665
  3.   Height = 797
  4.   Top = 225
  5.   Width = 1397
  6.   BorderIcons = [biSystemMenu, biMinimize]
  7.   BorderStyle = bsSingle
  8.   Caption = 'Pikietaż 3 3.0.0.3'
  9.   ClientHeight = 777
  10.   ClientWidth = 1397
  11.   Font.Height = 14
  12.   Font.Name = 'Default'
  13.   Icon.Data = {

After - when project is opened in Lazarus - wrong word: PikietaĹĽ

Code: Pascal  [Select][+][-]
  1. object Form1: TForm1
  2.   Left = 381
  3.   Height = 797
  4.   Top = 180
  5.   Width = 1397
  6.   BorderIcons = [biSystemMenu, biMinimize]
  7.   BorderStyle = bsSingle
  8.   Caption = 'PikietaĹĽ 3 3.0.0.3'
  9.   ClientHeight = 777
  10.   ClientWidth = 1397
  11.   Font.Height = 14
  12.   Font.Name = 'Default'
  13.   Icon.Data = {

2.
Quote
Did you load source files into another editor which could have corrupted the encoding?

No I only use Lazarus editor.

3.
Code: Pascal  [Select][+][-]
  1. If you now edit the label texts to replace the wrong characters and save and reload again do the labels remain correct or are they corrupted again?
I did this many times. Sometimes I have feeling that it's OK when computer is ON. But if I my computer is OFF, next ON and I want to work on project, I have this problem.

wp

  • Hero Member
  • *****
  • Posts: 11830
Re: Strange behaviour of Lazarus.
« Reply #7 on: March 14, 2017, 09:05:10 am »
The files that you uploaded seem to contain the error already: After downloading again and opening unit.lfm in Notepad++ I see " Caption 'PikietaĹĽ 3 3.0.0.3'". Could you please upload the original (=correct) files?

And, please, don't use an external server, your files will be gone after a while and users visiting this thread later will not be able to load the project any more. Instead, use the "Attachments and other options" below the input field of the forum editor to upload the zip file to the forum. Remove the lib folder as well as any compiler-generated files from your zip, these files are not needed to compile the project and they will just blow up the upload size. Essentially, the zip should only contain pas, lfm, lpi and lpr files (plus some data files -- but this is not required in your case).

What happens if you create a new project with just a label containing Polish characters? Does it show the same problem?

Find out the directory which contains the Lazarus settings. In Windows 10 this is normally c:\Users\<your name>\AppData\Local\Lazarus. Or, if you have a secondary installation, you find the name of the settings folder in the file Lazarus.cfg in the directory containing Lazarus.exe. Close Lazarus, rename the settings folder and restart Lazarus again - this will create a new settings folder with original default settings. Does the error persist? (To restore the old settings just delete the new settings folder and rename the original one back).

Przemyslav

  • New Member
  • *
  • Posts: 44
Re: Strange behaviour of Lazarus.
« Reply #8 on: March 16, 2017, 03:15:52 am »
I solved the problem. I created a new project with "empty" files like: *.lfm, *.pas. Second I copied content of my "wrong" files to the new files. I saved, reopen project and voila everything it's OK :) Every file has got proper coding in UTF-8.

Big thanks for your help. I am grateful :)

 

TinyPortal © 2005-2018