Button is copied in wrong encoding with another layout
Moderators: Hacker, petermad, Stefan2, white
Button is copied in wrong encoding with another layout
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)
Does TC copy button code in ANSI? Or why such bug occurs?
(TC 7.55 RC3)
- ghisler(Author)
- Site Admin
- Posts: 50541
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
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...
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
https://www.ghisler.com
https://www.ghisler.com
- ghisler(Author)
- Site Admin
- Posts: 50541
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
I'm using UTF-8 for compatibility reasons, but only in fields which contain characters from other codepages.why TC can't copy Unicode text to clipboard?
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
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.
{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.

Re: Button is copied in wrong encoding with another layout
2MVVMVV 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?
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?
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
Ukraine's National Bank special bank account:
UA843000010000000047330992708