in reply to opening accented file names
This works for me:
D:\>chcp Active code page: 1252 D:\>dir acentó.dat /b acentó.dat D:\>type test.pl #!perl use strict; use warnings; my $fn = 'acentó.dat'; if (open my $fh, '<', $fn) { print "Successfully opened file '$fn'\n"; close $fh; } else { print "Error opening file '$fn': $!\n"; } D:\>perl test.pl Successfully opened file 'acentó.dat' D:\>perl -ne "print $1 if m/(acentó)/" test.pl acentó D:\>perl -ne "print $1 if m/(acentó)/" test.pl | od -h 0000000000 61 63 65 6E 74 F3 0000000006 D:\>perl -v | fmt -w 53 This is perl 5, version 12, subversion 2 (v5.12.2) built for MSWin32-x86-multi-thread (with 8 registered patches, see perl -V for more detail) Copyright 1987-2010, Larry Wall Binary build 1202 [293621] provided by ActiveState http://www.ActiveState.com Built Sep 6 2010 23:36:03 Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page. D:\>
There's no use utf8 in the script because there's no Unicode text here. The text is in the Windows-1252 character encoding, also called CP1252, ANSI and Western European. The ó character is \xF3.
In general, you can't use Perl on Microsoft Windows to handle Unicode folder and file names. See Is File::Find Unicode-(Conformant|Compliant|Enabled|Capable)?, dos path accents and renaming subdirectories on MS Windows for more details.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: opening accented file names
by BrowserUk (Patriarch) on Nov 11, 2010 at 22:36 UTC | |
by Jim (Curate) on Nov 12, 2010 at 01:00 UTC | |
by BrowserUk (Patriarch) on Nov 12, 2010 at 02:06 UTC | |
by Jim (Curate) on Nov 12, 2010 at 05:39 UTC | |
by BrowserUk (Patriarch) on Nov 12, 2010 at 06:02 UTC | |
|