http://qs321.pair.com?node_id=11148358

BernieC has asked for the wisdom of the Perl Monks concerning the following question:

I have a file that *should* be all ISO-latin, but the program that created it seems to sprinkle UTF-8 characters round in it. For example, the file begins

ef bb bf 49 6d 70 6f 46 69 72 73 74 20 4e 61 6d

later on there's

2c 2c 2c 2c 2c 2c 2c 2c 2c 2c 2c 2c 22 ef bb bf 39 35 33 2d 31 35 31 33 0d 0a 53 63 6f 74 74 20

And that kind of thing pops up all throughout the file. I tried "cleaning" it by running every line through

$line = Encode::encode("ISO-8859-1", $line);

But it didn't help. I also tried

$text =~ s/^\xef\xbb\xbf//g ;

It didn't help either. Is there some way to get rid of it all?