aMSN Forums
July 29, 2010, 04:06:18 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: New forum for aMSN !!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: (Turkish) encoding problem while pasting  (Read 5139 times)
OktayD
Newbie

Offline Offline

Posts: 14


View Profile
« on: January 19, 2007, 09:00:31 pm »

Hi,
I have an encoding problem in pasting function of amsn. When I copy some text from other applications and paste them by ctrl+v or right-clicking the menu item, it comes as something like:
Code:
kusulas\u0131 i\u011frenç ba\u015fl\u0131klar\u0131

these chars are ı, ğ and ş (if you could see). I could paste texts correctly by the middle click.

And it doesn't seem like it's from tcl/tk because I did try another tcl/tk application.
Also note that it has been a problem in distros like Open Suse 10.0, Mandrake 10.1, Ubuntu 6.10 and finally Pardus 2007 (which is a Turkish distro!)

Good luck...
Logged
vivia
Administrator
Super Power User
*****
Offline Offline

Posts: 2436



View Profile
« Reply #1 on: January 19, 2007, 11:44:27 pm »

Try to change aMSN's encoding to UTF-8.

I suspect that it is because we override the paste functions (with ctrl+v or from the menu) to make it possible to copy-paste smilies.
Logged
hillingar
Newbie

Offline Offline

Posts: 30


View Profile
« Reply #2 on: January 20, 2007, 04:10:53 am »

Changing to utf-8 doesn't work. Actually, I played with the code a little bit, for example, in the chatwindow.tcl file, after the lines

Code:

                bind $text <<Button3>> "tk_popup $w.copypaste %X %Y"
                bind $text <<Button2>> "paste $w 1"


in proc CreateInputFrame, I tried inserting

Code:

                bind $text <Control-V> "tk_textPaste $text"


or

Code:

                bind $text <Control-V> "paste $w 1"


but neither worked. But now that you say that code is overridden, I see why it doesn't work. In what part of the code is it overridden?
Logged
OktayD
Newbie

Offline Offline

Posts: 14


View Profile
« Reply #3 on: January 20, 2007, 08:27:25 am »

Note that I could type or copypaste anything correctly inside aMSN, only pasting from other apps doesnt work.
I think not all the paste shortcuts call the same paste function :roll:
Logged
vivia
Administrator
Super Power User
*****
Offline Offline

Posts: 2436



View Profile
« Reply #4 on: January 20, 2007, 01:25:20 pm »

I remember I had some issues pasting Japanese. It made a difference whether I pasted with the original text selected but now I cannot remember whether it had to be selected or not. Try both combinations.
Logged
hillingar
Newbie

Offline Offline

Posts: 30


View Profile
« Reply #5 on: January 21, 2007, 06:53:17 pm »

What do you mean "it has to be selected"? That is, isn't that necessary to copy the text anyway?

In the current situation selection + middle button click works ok, but ctrl+v or the "paste" menu entry doesn't. If there's another copy/paste mechanism please tell and I'll try. But more importantly, if the the bindings in chatwindow.tcl get overridden somewhere, could you please point me to that part of the code? We know it's not a Tcl/Tk issue as our tiny test program worked correctly.
Logged
kakaroto
Administrator
Super Power User
*****
Offline Offline

Posts: 9390


View Profile WWW
« Reply #6 on: January 21, 2007, 09:09:52 pm »

hello,
this issue is with tcl/tk. there are two clipboard, there is a 'system clipboard' and an 'application clipboard'. amsn has no access to the system clipboard, it actually is Xorg/Xfree that takes care of that and it doesn't allow applications to access it (or at least, tk applications can't). So how this works is really weird and I spent a lot of time trying to figure that out.
When you select a text in any application, X copies the text, if you middle click in amsn AND that other text you copied is STILL selected (the selection didn't disappear when you clicked somewhere else), then that text will be pasted into amsn (by X, amsn does nothing). If the text has been unselected because you clicked somewhere, it *should* still be in the clipboard, but it isn't so when you middle click, amsn realizes that the system clipboard is empty, so nothing will be pasted, so it takes over and it pastes the content of the 'application clipboard'.
To easily understand this, type some text in a chat window with some smileys, then select the text, middle click and you'll see the text pasted but without the smileys, that's because X doesn't see the smiley's text and only copies/pastes the text (from/to the system clipboard), now single-click somewhere in the chatwindow to unselect the text that was selected, and now middle click again in the chat window, you'll see that the text is pasted with the smileys this time. This is because when you selected, amsn took care of transforming the smileys into text but could only put that information in the application clipboard, so when you middle clicked to paste, amsn checked the system clipboard, found out it was empty, so it manually did a paste from the application clipboard which contained the text with the smileys.
Ctrl-V is application driven, it's not a middle click so it's not being taken care of by the system, so I think a ctrl-V will paste the application clipboard, not the system clipboard (although I think when a selection is done, we 'try' to copy the content of the system clipboard to the application clipboard, but I'm not sure if it's true or if it always works).

so in other words, what vivia told you to do is to make sure the text is still selected when you do your paste, and I'm telling you to make sure you do it with the middle click.

I'm curious though about you saying "it works with other applications', I'd like to know if those other applications let the system do the pasting or if they override the pasting themselves, or whatever.. could you tell us which other tk application you tried this with ?
Also, could you try to paste in another window, like maybe the change nickname, or notes or the add/edit custom state windows, I'd like to see whether it is a specific issue with the handling of pasting in the chat window or not (because of the smilies thing), if it works correctly in other windows, maybe I can find a way to fix this issue with system/application clipboard once and for all.

I hope this post was helpful to you.

Thanks
Logged

KaKaRoTo
hillingar
Newbie

Offline Offline

Posts: 30


View Profile
« Reply #7 on: January 22, 2007, 10:53:34 pm »

Thank you for the detailed explanation. Here is what I tried and found:

Selecting smileys works exactly as you say. Pasting with middle click doesn't work anywhere but with the menu or ctrl+v you can paste the smileys anywhere (in & out of aMSN).

However, the mid-click works in AMSN and elsewhere even when the selection is gone. Until I select something new, I can paste the last selection (and it has ever been so afaik, but maybe I'm wrong and it's only so in the new x.org versions. Mine is 6.9.).

The application I tried was a 5-line Tk script, just a textbox with a binding for Ctrl+v. There I could type in Turkish characters, copy external text with Ctrl+C paste them into my test app with Ctrl+v. The binding used tk_textPaste.

What I don't understand is this: In the aMSN code, the bindings to midlick and ctrl+v are  "paste $w 1" and "tk_textPaste $text", respectively. I couldn't find the paste proc, but binding ctrl+v or some other unused key combo to it and tk_textPaste didn't work either. Combining this with what you explained, I assume that these procs don't work at all, the pasting is indeed done by the midclick. But then why did Ctrl+v bound to tk_textPaste work in my little test window? It was that what made me think that this may not be a Tcl/Tk issue.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!