This forum uses cookies. Click X button to hide this message. What is stored? 
Total Commander Forum Index Total Commander
Forum - Public Discussion and Support
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Button is copied in wrong encoding with another layout

 
Post new topic   Reply to topic    Total Commander Forum Index -> Bug reports from previous betas (unresolved) Printable version
View previous topic :: View next topic  
Author Message
MVV
Power Member
Power Member


Joined: 03 Aug 2008
Posts: 7700
Location: Russian Federation

PostPosted: Fri Jun 04, 2010 1:26 am    Post subject: Button is copied in wrong encoding with another layout Reply with quote

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)
_________________
TCFS2 + TCFS2Tools: Full-screen mode for TC etc (forum)
TOTALCMD.NET: AskParam, CopyTree, NTLinks, Sudo, VirtualPanel…
Back to top
View user's profile Send private message Send e-mail
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 33427
Location: Switzerland

PostPosted: Fri Jun 04, 2010 2:50 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
MVV
Power Member
Power Member


Joined: 03 Aug 2008
Posts: 7700
Location: Russian Federation

PostPosted: Fri Jun 04, 2010 2:53 am    Post subject: Reply with quote

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.
_________________
TCFS2 + TCFS2Tools: Full-screen mode for TC etc (forum)
TOTALCMD.NET: AskParam, CopyTree, NTLinks, Sudo, VirtualPanel…
Back to top
View user's profile Send private message Send e-mail
ghisler(Author)
Site Admin
Site Admin


Joined: 04 Feb 2003
Posts: 33427
Location: Switzerland

PostPosted: Sun Jun 06, 2010 4:10 am    Post subject: Reply with quote

Quote:
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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
MVV
Power Member
Power Member


Joined: 03 Aug 2008
Posts: 7700
Location: Russian Federation

PostPosted: Sun Jun 06, 2010 7:19 am    Post subject: Reply with quote

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. Smile
_________________
TCFS2 + TCFS2Tools: Full-screen mode for TC etc (forum)
TOTALCMD.NET: AskParam, CopyTree, NTLinks, Sudo, VirtualPanel…
Back to top
View user's profile Send private message Send e-mail
luckylee
Junior Member
Junior Member


Joined: 21 Mar 2014
Posts: 2

PostPosted: Sun Mar 23, 2014 1:14 pm    Post subject: Reply with quote

ghisler(Author) wrote:
Quote:
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.
Back to top
View user's profile Send private message
MVV
Power Member
Power Member


Joined: 03 Aug 2008
Posts: 7700
Location: Russian Federation

PostPosted: Sun Mar 23, 2014 1:21 pm    Post subject: Reply with quote

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.
_________________
TCFS2 + TCFS2Tools: Full-screen mode for TC etc (forum)
TOTALCMD.NET: AskParam, CopyTree, NTLinks, Sudo, VirtualPanel…
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Total Commander Forum Index -> Bug reports from previous betas (unresolved) All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Impressum: This site is maintained by Ghisler Software GmbH

Using phpBB © 2001-2005 phpBB Group