Recent

Author Topic: [SOLVED] Copy text from LCL control to external application corrupts data  (Read 4640 times)

guest58172

  • Guest
Let's say i have a TTreeNode.Text set to "µs".
If i copy this to the clipboard and paste it in another application i get "μs" instead.

I use Lazarus 1.6.4 under linux, GTK2 widgetset. Would it be an option i forgot to set  to get a properly working UTF8 LCL ?

Note:  there's no problem within the same Lazarus application. It's really from LCL to 3rd part.

guest58172

  • Guest
Re: Copy text from LCL control to external application corrupts data
« Reply #1 on: January 10, 2018, 06:10:17 pm »
Just added "{$CODEPAGE UTF8} " to my global inc file and no change.
Seems to be for source code string literal anyway.

Bart

  • Hero Member
  • *****
  • Posts: 5290
    • Bart en Mariska's Webstek
Re: Copy text from LCL control to external application corrupts data
« Reply #2 on: January 10, 2018, 07:15:38 pm »
I can copy from Lazarus IDE to Kate (including non-ASCII) without any problems on Linux Mint 18.2.

Bart

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4468
  • I like bugs.
Re: Copy text from LCL control to external application corrupts data
« Reply #3 on: January 10, 2018, 07:25:02 pm »
Let's say i have a TTreeNode.Text set to "µs".
If i copy this to the clipboard and paste it in another application i get "μs" instead.

I use Lazarus 1.6.4 under linux, GTK2 widgetset. Would it be an option i forgot to set  to get a properly working UTF8 LCL ?
No, all strings are UTF-8 by default.
{$CODEPAGE UTF8} is not needed either. See:
 http://wiki.lazarus.freepascal.org/Unicode_Support_in_Lazarus#String_Literals
You have added something extra into your configuration.
You should update to Lazarus 1.8 although it should not make difference for this issue.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

guest58172

  • Guest
Re: Copy text from LCL control to external application corrupts data
« Reply #4 on: January 10, 2018, 07:43:38 pm »
I started a new simple application without settings overridden and there's also a corruption, different though.

Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormClick(Sender: TObject);
  2. begin
  3.   Clipboard.AsText:= 'µs';
  4. end;  

Then i paste in a website and get: µs.
Now the more funny, when writing this answer, I've copied some code from Laz, i.e what you see above, and the literal was also wrong !

guest58172

  • Guest
Re: Copy text from LCL control to external application corrupts data
« Reply #5 on: January 10, 2018, 08:38:40 pm »
Let's say i have a TTreeNode.Text set to "µs".
If i copy this to the clipboard and paste it in another application i get "μs" instead.

I use Lazarus 1.6.4 under linux, GTK2 widgetset. Would it be an option i forgot to set  to get a properly working UTF8 LCL ?
No, all strings are UTF-8 by default.
{$CODEPAGE UTF8} is not needed either. See:
 http://wiki.lazarus.freepascal.org/Unicode_Support_in_Lazarus#String_Literals
You have added something extra into your configuration.
You should update to Lazarus 1.8 although it should not make difference for this issue.

I've just checked and It's fixed by Laz 1.8 but i cant use 1.8 because this version breaks many things.
Actually since 1.8 RC1 i came back to 1.6.4.

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: Copy text from LCL control to external application corrupts data
« Reply #6 on: January 10, 2018, 08:39:00 pm »
Yup. Same here with your example. Works now.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

guest58172

  • Guest
Re: Copy text from LCL control to external application corrupts data
« Reply #7 on: January 10, 2018, 08:47:04 pm »
I wonder if it was not due to the trailing null clipboard bug under GTK2...(applied in 1.6.4 but reverted in 1.8.0)
BTW how can i build for GTK3 ou QT5 (compile fail during linking))? I'd like to test 1.8 before coming back to 1.6.4...

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4468
  • I like bugs.
Re: Copy text from LCL control to external application corrupts data
« Reply #8 on: January 11, 2018, 12:02:32 am »
I've just checked and It's fixed by Laz 1.8 but i cant use 1.8 because this version breaks many things.
Not true. You added an "alternative fact" now.

I wonder if it was not due to the trailing null clipboard bug under GTK2...(applied in 1.6.4 but reverted in 1.8.0)
No, it was put inside
  {$IFDEF GTK_REMOVE_CLIPBOARD_NULL}
Just build Lazarus with the define and you are good. It was added there mainly for you. Most other people did not experience the clipboard NULL problem. Everybody however experiences a copy/paste problem between Lazarus instances when you use the define.
BTW, you were informed then but somehow you forgot. :(
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

guest58172

  • Guest
Re: Copy text from LCL control to external application corrupts data
« Reply #9 on: January 11, 2018, 02:57:52 am »
it was added there mainly for you. Most other people did not experience the clipboard NULL problem. Everybody however experiences a copy/paste problem between Lazarus instances when you use the define.

Thanks much BTW. The worst being that since it was reported, fixed and finally reverted i've changed my main OS. I've setup Laz 1.8 yesterday and then this damn null trailing character is back again (unless i rebuild the LCL with the define you generously left for me).

We still don't know what exactly is the real problem.

 

TinyPortal © 2005-2018