Recent

Author Topic: [SOLVED]Lazarus 1.6 and lazUTF8 it's a nightmare for me...  (Read 4942 times)

Robert W.B.

  • Sr. Member
  • ****
  • Posts: 331
  • Love my Wife, My Kids and Lazarus/Freepascal.
[SOLVED]Lazarus 1.6 and lazUTF8 it's a nightmare for me...
« on: April 05, 2016, 04:16:05 am »
Have merci on me.
I have to replace utf8encode and utf8decode to UTF8ToWinCP and winCPToUtf8 in all of my programs made with lazarus, there is 20-30 places in my code i will have to replace it but it still not work!!!
Replace UTF8String to String! just to be able to show å ä ö

And it seems to be no logic over it. Sometimes in a sentence with åäö, You have to use UTF8ToWinCP other times in another sentence with åäö you don't have to use UTF8ToWinCP because it will not show the signs åäö at all! This is making me crazy.

Is there no global way to set åäö to work after compiling the code?
Best regards



« Last Edit: April 05, 2016, 05:39:09 pm by robbanux »
Rob

Thaddy

  • Hero Member
  • *****
  • Posts: 18792
  • Glad to be alive.
Re: Lazarus 1.6 and lazUTF8 it's a nightmare for me...
« Reply #1 on: April 05, 2016, 07:48:45 am »
Are you by any chance using 1.6 with fpc 2.6.4?
Recovered from removal of tumor in tongue following tongue reconstruction with a part from my leg.

Bart

  • Hero Member
  • *****
  • Posts: 5706
    • Bart en Mariska's Webstek
Re: Lazarus 1.6 and lazUTF8 it's a nightmare for me...
« Reply #2 on: April 05, 2016, 02:40:36 pm »
utf8encode and utf8decode convert WideString to UTF8 and vice versa.
Why would you think you need to replace that with Utf8ToWinCP, which converts from UTF8 to current windows codepage?

Why yet another thread about this?
You stated it was solved in this thread by you.

Bart

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4695
  • I like bugs.
Re: Lazarus 1.6 and lazUTF8 it's a nightmare for me...
« Reply #3 on: April 05, 2016, 05:22:37 pm »
Robbanux, you asked about the same utf8encode and utf8decode here:
  http://forum.lazarus.freepascal.org/index.php/topic,31713
but apparently did not read the answers.
Then you opened another thread for the same thing:
  http://forum.lazarus.freepascal.org/index.php/topic,32086

Now this is the third thread about the exact same issue. You already got many valid answers earlier. Please read them instead of opening new threads!
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Robert W.B.

  • Sr. Member
  • ****
  • Posts: 331
  • Love my Wife, My Kids and Lazarus/Freepascal.
Re: Lazarus 1.6 and lazUTF8 it's a nightmare for me...
« Reply #4 on: April 05, 2016, 05:38:47 pm »
I know i'm like the plague but, I don't get it and it gives me Migraine attacks!
I Love Lazarus but it's no picnic to code with Migraine anyway.

I'm not that good as You guys, with understanding coding and probably I should stay with my Guitarplaying instead.

I really read the answers and Bart was nice, in my misery and gave me a real answer to the problem.

No more UTF8 questions from me, I promises You.

Lazarus 1.6 r51630 FPC 3.0.0 x86_64-win64-win32/win64

Take care
« Last Edit: April 05, 2016, 05:40:36 pm by robbanux »
Rob

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4695
  • I like bugs.
Re: [SOLVED]Lazarus 1.6 and lazUTF8 it's a nightmare for me...
« Reply #5 on: April 05, 2016, 06:40:56 pm »
Just remove all explicit conversions. It was mentioned already in the replies.
Maybe the solution is "too easy" and you try to make it more difficult.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

wp

  • Hero Member
  • *****
  • Posts: 13424
Re: [SOLVED]Lazarus 1.6 and lazUTF8 it's a nightmare for me...
« Reply #6 on: April 05, 2016, 07:18:36 pm »
Just remove all explicit conversions.
I disagree in this generality. It is needed when working with ANSI-coded files, and it's backward compatible with fpc 2.6.4 (http://forum.lazarus.freepascal.org/index.php/topic,31713.msg206235.html#msg206235).

Thaddy

  • Hero Member
  • *****
  • Posts: 18792
  • Glad to be alive.
Re: [SOLVED]Lazarus 1.6 and lazUTF8 it's a nightmare for me...
« Reply #7 on: April 05, 2016, 09:38:03 pm »
I disagree in this generality. It is needed when working with ANSI-coded files, and it's backward compatible with fpc 2.6.4 (http://forum.lazarus.freepascal.org/index.php/topic,31713.msg206235.html#msg206235).
Let 2.6.4 die in many pieces. The new approach is much better. Ansi encodings included. It was very good while it lasted. But...
« Last Edit: April 05, 2016, 09:40:14 pm by Thaddy »
Recovered from removal of tumor in tongue following tongue reconstruction with a part from my leg.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4695
  • I like bugs.
Re: Lazarus 1.6 and lazUTF8 it's a nightmare for me...
« Reply #8 on: April 05, 2016, 11:10:59 pm »
I really read the answers and Bart was nice, in my misery and gave me a real answer to the problem.

Well, Bart told you to read your earlier thread...

Quote
No more UTF8 questions from me, I promises You.

It is ok to ask but please also read the answers. If your input data has Ansi codepage encoding, then you can convert it explicitly as wp wrote or use SetCodePage() which is also documented and explained.
Once the data is converted to UTF-8, it is all happy sailing. No Migraine.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

 

TinyPortal © 2005-2018