Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Tk::DropSite unicode path

by Anonymous Monk
on Feb 14, 2018 at 15:45 UTC ( #1209145=perlquestion: print w/replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

My beloved Monks

Am I correct in assuming that Tk::DragDrop is not able to manage Unicode file names? If I drag a file from my Desktop to the drop area, I get ??? instead of my user Name (which is rq). And I cannot process it anymore. I am on Windows 10 nad using the latest Tk release. This is the normal Code I am using:

#!/usr/local/bin/perl -w use Tk; use Tk::DropSite; use strict; use vars qw($top $drop); $top = new MainWindow; $top->Label(-text => "The drop area:")->pack; $drop = $top->Scrolled('Listbox', -scrollbars => "osoe", )->pack; my $SomeVariable="xxx"; $drop->DropSite (-dropcommand => [\&accept_drop, $drop, $SomeVariable], -droptypes => ($^O eq 'MSWin32' ? 'Win32' : ['KDE', 'XDND', 'Sun']) ); MainLoop; sub accept_drop { my ($drop, $SomeVariable, $selection) = @_; print "This is my variable passed from the main: $SomeVariable\n"; my $filename; eval { if ($^O eq 'MSWin32') { $filename = $drop->SelectionGet(-selection => $selection, 'STRING'); } else { $filename = $drop->SelectionGet(-selection => $selection, 'FILE_NAME'); } }; $drop->insert(0, $octets); if (defined $filename) { $drop->insert(0, $filename); } } __END__

Replies are listed 'Best First'.
Re: Tk::DropSite unicode path
by beech (Vicar) on Feb 14, 2018 at 22:40 UTC

    Hi,

    This is a bug you should report it to rt://Tk

    I tried to fix it by editing  Tk-804.034\DragDrop\Win32Site\Win32Site.xs and changing DragQueryFile to DragQueryFileW but it needs more edits

Re: Tk::DropSite unicode path
by Anonymous Monk on Feb 14, 2018 at 15:46 UTC

    My username is a series of Chinese characters which were not displayed in the post above

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1209145]
Approved by Eily
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (12)
As of 2018-04-19 21:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?