in reply to A 'special' character in utf8?

use open ':std', ':encoding(UTF-8)';

That will add :encoding(UTF-8) to STDIN, STDOUT and STDERR.

Update: I just noticed the last line:

I can get rid of the errors by using binmode STDOUT, ":encoding(utf8)" but the output is still messed up.

That's what you should be done. What I suggested about is the same thing. Using :encoding(utf-8) on both your input and your output is indeed the way to go. (utf8 is similar, and will work too.) If your output is messed up, we'll need more info, such as a dump (od -t x1) of the offending data in the input file and a dump of the corresponding messed up output.