in reply to binmode STDOUT, ":utf8"; and umlauts
String arguments passed to system calls are treated as binary strings. That is, if you provide a string to a system call, perl will actually pass its internal representation of the string, and that may not be what you want.
For instance, this similarly looking code will probably not perform as expected:
As code-points $file and "menü" are exactly the same. However, the internal representation of the two strings could be very different. The work-around is to use Encode to explicitly ensure that the correct encoding is used:my $file = "men".chr(0xdc); open(FIND, "find ... -name $file|");
use Encode; my $file = ...; open(FIND, "find ... -name ".encode("utf-8", $file)."|");
Whether or not "utf-8" is correct in this case depends on your OS, how you are using your file system and how find is going to interpret the argument.
|
---|