Skip Menu |
 

This queue is for tickets about the Tk CPAN distribution.

Report information
The Basics
Id: 82203
Status: stalled
Priority: 0/
Queue: Tk

People
Owner: Nobody in particular
Requestors: pacificsymphony5 [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 804.029
Fixed in: (no value)



Subject: unicode not displayed properly in getOpenFile
Download (untitled) / with headers
text/plain 647b
Directories whose names contain non-Latin unicode characters are not displayed properly in getOpenFile. To reproduce the bug, execute the attached script. It creates a directory with Greek characters in its name, then pops up a dialog box to open a file. The directory doesn't show up properly in the file dialog. The program writes output to the terminal showing the versions of Tk and perl, and on unix it will also verify that the name of the created directory has Greek letters and that the script itself is encoded in unicode. Info about the system on which I observed the bug: Tk version is 804.029. Perl version is 5.14.2. Ubuntu 12.04.1.
Subject: bug.pl
Download bug.pl
text/x-perl 751b
#!/usr/local/bin/perl use Tk; print "Tk version is ",$Tk::VERSION,".\n"; print "Perl version is ",(sprintf "%vd",$^V),".\n"; my $directory_name = "in_Ελληνικά"; mkdir $directory_name or die "error creating directory $directory_name, $!"; -d $directory_name or die "did mkdir $directory_name, but it doesn't exist??"; print `ls`; # on unix, will demonstrate that the directory really does have Greek characters in it print `file bug.pl`; # on unix, will tell you whether the source code is encoded in unicode, as it should be my $mw = new MainWindow; $mw->getOpenFile(); my $button = $mw -> Button(-text => "Quit",-command => sub { rmdir $directory_name or die "error removing directory $directory_name, $!"; exit(); })-> pack(); MainLoop;
Download (untitled) / with headers
text/plain 1.4k
On 2012-12-24 13:49:04, http://ben-crowell.myopenid.com/ wrote: Show quoted text
> Directories whose names contain non-Latin unicode characters are not > displayed properly in getOpenFile. > > To reproduce the bug, execute the attached script. It creates a > directory with Greek characters in its name, then pops up a dialog box > to open a file. The directory doesn't show up properly in the file > dialog. The program writes output to the terminal showing the versions > of Tk and perl, and on unix it will also verify that the name of the > created directory has Greek letters and that the script itself is > encoded in unicode. > > Info about the system on which I observed the bug: Tk version is > 804.029. Perl version is 5.14.2. Ubuntu 12.04.1.
Well, things are not so easy when dealing with perl and encodings and file names. Actually, there's no support in perl for it at all. You can find a TODO entry named "Unicode in Filenames" here: http://perl5.git.perl.org/perl.git/blob/HEAD:/Porting/todo.pod And actually your test script is buggy: the script does not specify an encoding, so all strings have to be treated as latin-1. You also did not make sure that $directory_name is encoded as utf-8 e.g. using Encode.pm. So perl and Tk cannot know that the directory name was meant as utf-8. I'll mark this ticket as stalled for now. Maybe perl will provide support for unicode filenames some day. Maybe Tk's file selector can have an extra option to express the wished encoding, as a workaround until perl catches up. Regards, Slaven


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.