Button is copied in wrong encoding with another layout

Bug reports will be moved here when the described bug has been fixed

Moderators: white, Hacker, Stefan2, sheep

Post Reply
User avatar
MVV
Power Member
Power Member
Posts: 8064
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Button is copied in wrong encoding with another layout

Post by *MVV » 2010-06-04, 07:26 UTC

E.g. I have buttonbar button with Russian hint. If I have EN keyboard layout active when copying button via context menu, TC copies button code in wrong encoding (even when I paste text into Unicode application, text is wrong), but if I switch to RU all is right.

Does TC copy button code in ANSI? Or why such bug occurs?

(TC 7.55 RC3)

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 36002
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) » 2010-06-04, 08:50 UTC

This is a known Windows bug: When you call SetClipboardData(CF_TEXT,..) and do not explicitly set the encoding, Windows seems to use the current keyboard layout for the encoding. Since TC ignores the encoding setting of the clipboard when you paste a button, this doesn't matter for copying/pasing buttons, it only matters when you want to paste the button details somewhere else.

I even have a fix for this bug in TC: Call SetClipBoarddata(CF_LOCALE,...). I just didn't use it in this function because it wasn't meant to copy button data anywhere else...
Author of Total Commander
http://www.ghisler.com

User avatar
MVV
Power Member
Power Member
Posts: 8064
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV » 2010-06-04, 08:53 UTC

I know it (that's because I guessed to change layout to see that all works fine with RU), but why TC can't copy Unicode text to clipboard? In this case all will work fine. If TC now is Unicoded, it should be easier to use wide strings instead of short ones.

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 36002
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) » 2010-06-06, 10:10 UTC

why TC can't copy Unicode text to clipboard?
I'm using UTF-8 for compatibility reasons, but only in fields which contain characters from other codepages.
Author of Total Commander
http://www.ghisler.com

User avatar
MVV
Power Member
Power Member
Posts: 8064
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV » 2010-06-06, 13:19 UTC

I don't understand. When you're copying text to clipboard, you can copy it in any encoding (just specify right one for clipboard format), and when you're pasting text from clipboard, you can choose in which encoding you want to see it, so it won't be a problem if you copy Unicode text in TC 7.55 and then try to paste it in local ANSI codepage in TC 7.04a e.g. - Windows will convert text for you (you just need to specify encoding).

{Get|Set}ClipboardData functions have format parameter that can be CF_TEXT for ANSI text and CF_UNICODETEXT for Unicode text, you can choose any of them for both functions and OS will do the rest. :)

luckylee
Junior Member
Junior Member
Posts: 2
Joined: 2014-03-21, 22:50 UTC

Post by *luckylee » 2014-03-23, 19:14 UTC

ghisler(Author) wrote:
why TC can't copy Unicode text to clipboard?
I'm using UTF-8 for compatibility reasons, but only in fields which contain characters from other codepages.
I believe UTF-8 is more universal encoding than Unicode.

User avatar
MVV
Power Member
Power Member
Posts: 8064
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV » 2014-03-23, 19:21 UTC

UTF-8 has some problems like length-size conversion etc. Also Windows API doesn't support it, it only supports Unicode (UTF-16) so text should be put into clipboard in UTF-16 in applications that support Unicode.

User avatar
DrShark
Power Member
Power Member
Posts: 1111
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262

Re: Button is copied in wrong encoding with another layout

Post by *DrShark » 2018-03-17, 10:33 UTC

MVV wrote:E.g. I have buttonbar button with Russian hint. If I have EN keyboard layout active when copying button via context menu, TC copies button code in wrong encoding (even when I paste text into Unicode application, text is wrong), but if I switch to RU all is right.

Does TC copy button code in ANSI? Or why such bug occurs?
2MVV
Isn't this issue fixed already? It seems it was fixed even before adding a support for pasting of a Unicode text to a button bar in TC 9.10.

If yes, maybe this topic should be moved to fixed bugs?
Android 4.3.1 no root, kernel 08.09.2016; Vista Home Premium SP2 rus 32 bit
TC #149847 Personal licence

Cuz we're all in this together, We're here to make it right

User avatar
MVV
Power Member
Power Member
Posts: 8064
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV » 2018-03-18, 19:20 UTC

Yes, it is fixed already, just rechecked - works ok.

Post Reply