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?


In reply to getting rid of UTF-8 by BernieC

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.