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 = (
					'documentação',
					'AC_RAÍZ_CERTICÁMARA_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)


In reply to Re^4: Accent file names issue by Anonymous Monk
in thread Accent file names issue by ruimelo73

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.