I'm running latest perl under german Windows 7 and I want to use utf8 everywhere in my perl programs (for the script, the file contents, file names, mail texts, etc.).
All works fine, but I'm facing problems when trying to process files having special characters in filename. Even system
calls do not work well. So (how) can I tell perl to use utf8
everywhere?
I tried a while with encode
and decode
but it's very unclear why that works as it works... Also I need to encode('cp850', TEXT)
for a correct display in the command prompt window.
Examples:
When I need to copy a file, it only works when I use File::copy(encode("iso-8859-1", $filename), ...)
and when I want to work with pdf file contens the successful command is system(encode('cp850', sprintf('pdftk.exe %s...', decode('utf8', $file))));
Why is that (especially the decode in the system call) and is there a more easy way? Maybe something with use open ':encoding...'
, but I had no luck so far.