The thing is that everything else that is printed (without setting the binmode) gets printed ok (does this mean that I already have the correct output mode?). So it feels like I'm trying to
data that isn't utf-8 from the beginning? (Can I test the incoming data in a simple manner?) I will look into the link you provided.