in reply to By the shine on my bald pate, I dislike this encoding stuff

open (ORDERFILE, '<:encoding(UTF-8)', $emailfile) or return (@err, "Co +uld not open order email file: $emailfile"); #... my $filedata = <ORDERFILE>; #... eval { my $utf8 = decode("utf8", $filedata, Encode::FB_CROAK ) };

First you're applying an IOLayer to a filehandle to obtain characters decoded from UTF-8, then you additionally decode unicode characters as if they were UTF-8 bytes. If this is working, it's by chance (i.e. when reading ASCII-only files).

You should either open with :encoding(UTF-8) (but then you'll get warnings on non-UTF-8 text) or open without the IOLayer and do the decoding manually with FB_CROAK option.