in reply to [SOLVED] encoding trouble

Essentially, you are reencoding UTF-8 as UTF-8. This is an alternative example of what's going on with the O being the output layer–

perl -E 'say "äöüÄÖÜß"'
äöüÄÖÜß

perl -CO -E 'say "äöüÄÖÜß"'
äöüÃÃÃÃ

Add this to your script, use open ":std", ":encoding(utf8)";

open explains what's going on.