Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

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


    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?

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (2)
As of 2018-07-21 10:18 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (446 votes). Check out past polls.