Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^4: Accent file names issue

by Anonymous Monk
on Sep 21, 2017 at 14:19 UTC ( #1199841=note: print w/replies, xml ) Need Help??


in reply to Re^3: Accent file names issue
in thread Accent file names issue

As stated, this only works on Windows, also the OP asked for support for Windows

But on Windows I myself would prefer to use Win32::LongPath, because it supports real Unicode Directories and also filename up to 32000 chars

Have a look on the following script: (You have to create these directories first)

use strict;
use warnings;

use utf8;
use feature 'unicode_strings';
use charnames ':full';

binmode(STDOUT, ":unix:utf8");


my @strange_dirs = (
					'documentao',
					'AC_RAZ_CERTICMARA_S',
					'Катюша',
					'Катюша',
					'москва',
					'ελληνικά-русский',
										
);

for my $dir (@strange_dirs)	{
	print "Looking for directory: [$dir]\n";

	if (-d decode_u8($dir)) {
		print "Directory found: [$dir]\n";
	}
	else	{
		print "---> Error: Directory [$dir] not found <---\n";
	}
}

print "---- now the same with Win32::Longpath ----\n";

use Win32::LongPath;
 
for my $dir (@strange_dirs)	{
	print "Looking for directory: [$dir]\n";

	if (testL ('d', $dir)) {	# same as -d $dir
		print "Directory found: [$dir]\n";
	}
	else	{
		print "---> Error: Directory [$dir] not found <---\n";
	}
}
 



sub encode_u8 { my $s = shift; utf8::encode($s); $s };
sub decode_u8 { my $s = shift; utf8::decode($s); $s };

You will see that Win32::LongPath correctly displays all these directories, but -d decode_u8($dir) doesn't.

My test Environment is: Windows 10 Version 10.0.14393, Perl 64-bit (revision 5 version 22 subversion 2)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1199841]
help
Chatterbox?
and all is quiet...

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















    Results (451 votes). Check out past polls.

    Notices?