in reply to Re^2: Stupid UTF-8 issue with CSV file
in thread Stupid UTF-8 issue with CSV file

Don't just replace :utf8 with :encoding(iso-latin-1).

Instead of

my $qfn = $CFG->{admin_root_path}."/amazon_template_tmp/it_other.csv"; open(my $fh, '>:encoding(iso-latin-1)', $qfn) or die("Can't create \"$qfn\": $!\n"); print($fh $the_contents);
use
use Encode qw( encode ); my $qfn = $CFG->{admin_root_path}."/amazon_template_tmp/it_other.csv"; open(my $fh, '>:raw', $qfn) or die("Can't create \"$qfn\": $!\n"); print($fh encode('iso-latin-1', $the_contents, Encode::FB_HTMLCREF));

That way, characters that can't be encoded using iso-latin-1 will be replaced with HTML escapes (e.g. ♠).