Note below how ã changes to a. NOTE2: Before you blame this on CMD.EXE and Windows pipe weirdness, see Experiment 2 below which gets a similar problem using File::Find.
The particular problem I'm trying to fix involves working with image files stored on a local drive, and manipulating the file names which may contain foreign characters. The two experiments shown below are intermediate debugging steps.
The ã character is common in latin languages. e.g. http://pt.wikipedia.org/wiki/Cão
Experiment 1
Experiment 2
To get around my particular problem, I tried using File::Find instead of piped input. The issue actually gets worse:
Debugging update:
I tried some of the tricks listed at http://perldoc.perl.org/perlunicode.html,
e.g. use utf8, use feature 'unicode_strings', etc, to no avail.
Environment and Version Info
The OS is Windows 7, 64-bit.
The Perl is:
This is perl 5, version 12, subversion 2 (v5.12.2) built for MSWin32-x64-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 22:53:42