Recent

Author Topic: Converting from Delphi -> Lazarus : character errors  (Read 6429 times)

uwe

  • New Member
  • *
  • Posts: 13
Converting from Delphi -> Lazarus : character errors
« on: December 16, 2011, 09:51:27 am »
Hello,

I have the following problem: I convert a project from Delphi to Lazarus with the function integrated into the Lazarus IDE. The converting process works fine, the projects compiles and works well in Lazarus afterwards. After a few minor adjustments ( replacing some components etc.) I achieved the result I expected with one exception:

The new forms show correctly inside the Lazarus IDE but as soon as I compile and run the projects the special German characters appear as "? in the running application". That is strange because on the forms within the IDE they appear correctly.

Also I have compared the converted LFM files with LFM files that I have created with Lazarus itself and they look exactly identical. How comes Lazarus intereprets the files that have been converted from Delphi differently?

I have consulted a few forums on the internet and I found the hint that this has to do with the character set that is assigned to the source files. I tried changing the character sets of the PAS-files which had no effect. Changing the character set of the LFM-source files results in a compiling error.

Can anybody please tell me which steps I have to do in order to make the German characters appear correctly not in projects  converted from Delphi not only wihin the Lazarus IDE but also in the compiled program itself?

Thanks a lot in advance

Uwe

Shebuka

  • Sr. Member
  • ****
  • Posts: 427
Re: Converting from Delphi -> Lazarus : character errors
« Reply #1 on: December 16, 2011, 10:07:29 am »
try open file with notepad++, then convert characters to UTF-8 and then save file with UTF-8 encoding, doing so must fix the problem.

uwe

  • New Member
  • *
  • Posts: 13
Re: Converting from Delphi -> Lazarus : character errors
« Reply #2 on: December 16, 2011, 10:34:24 am »
Thanks for the answer.

I just tried that. I opened the LFM file with Notepad++ and hit "Convert to UTF-8". I tried UTF-8, UTF-8 with BOM and ANSI. Always the same result, the Lazarus-IDE shows the form correctly, as soon as it is compiled the running application shows "?". Any other ideas?

Would it be of help to attach the LFM-file to the posting?

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Converting from Delphi -> Lazarus : character errors
« Reply #3 on: December 16, 2011, 11:15:56 am »
Would it be of help to attach the LFM-file to the posting?

Yes. Is the text in question only in the LFM or is it also modified via code?

Shebuka

  • Sr. Member
  • ****
  • Posts: 427
Re: Converting from Delphi -> Lazarus : character errors
« Reply #4 on: December 16, 2011, 11:17:19 am »
Thanks for the answer.

I just tried that. I opened the LFM file with Notepad++ and hit "Convert to UTF-8". I tried UTF-8, UTF-8 with BOM and ANSI. Always the same result, the Lazarus-IDE shows the form correctly, as soon as it is compiled the running application shows "?". Any other ideas?

Would it be of help to attach the LFM-file to the posting?

after "Convert to UTF-8" you must also "Save As..." UTF-8 file, it's important to do both. For me works.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4467
  • I like bugs.
Re: Converting from Delphi -> Lazarus : character errors
« Reply #5 on: December 16, 2011, 11:31:43 am »
There is something broken in the char encoding stuff in Lazarus. See also this thread:
 http://lazarus.freepascal.org/index.php/topic,15137.msg81582.html

You should make a bug report with an example project if you can't solve it otherwise.
I don't understand the issue enough myself yet.

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

uwe

  • New Member
  • *
  • Posts: 13
Re: Converting from Delphi -> Lazarus : character errors
« Reply #6 on: December 16, 2011, 11:44:54 am »
Thanks for your help so far.

I did save the file after converting it to UTF-8 with the save-function of notepad++ (not save as but is there a difference?).

I will attach both the lfm-file (I changed the extension to .txt before sending it) and two screenshots of how the LFM appears in the IDE and how it shows as a running application to that post, maybe I am overseeing something obvious.

PS.: The reason why the program shows in "Windows 7 style" inside the IDE and in old "Windows XP style" while running is because I didn't include the manifist in the project settings. I have tried doing so, which changes the style but has no impact on the "?" characters.

Any other ideas?

uwe

  • New Member
  • *
  • Posts: 13
Re: Converting from Delphi -> Lazarus : character errors
« Reply #7 on: December 16, 2011, 11:55:14 am »
Hi again

I think I did oversee something obvious. I just used the "Convert encoding of projects/packages" funciton within the Lazarus-IDE, I haven't seen the function so far. Now it works just the way I wanted it too.

Thanks again for your help, and let me say: Discovering Lazarus is one of the best things that happened to me lately.

 

TinyPortal © 2005-2018