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

This is a completely new one on me. I have a perl script (a .pm actually) that was working perfectly until I got:
Unrecognized character \xC3 at Module.pm line 59.
When I delete line 59, I get the same error, this time on another line. When I delete whole blocks of text it still occurs, at a different line each time.

perldelta tells me that this error occurs when Perl comes across a character it can't parse. So I wonder if some strange escape code or snippet of binary has got in there. But I've tried running the file through filters, opening and re-saving it in different editors and the blighter still won't go away. Any suggestions on how to track down the pesky byte?

Replies are listed 'Best First'.
Re: Unrecognised characters
by jodrell (Acolyte) on Dec 12, 2002 at 21:58 UTC
    Just to add a bit more info: I'm using perl 5.8.0 on Red Hat 7.2. My main text editor is nano 1.0.9.
Re: Unrecognised characters
by graff (Chancellor) on Dec 13, 2002 at 03:36 UTC
    You should browse the perluniinto, perlunicode and encode man pages for v5.8 -- these are very instructive. (It was very good that you mentioned which version you're using, because there are important new things in 5.8.)

    When you mention deleting lines, you're talking about lines in some text data file, rather than lines in a .pm file, right? I mean, why delete lines of code rather than fix them -- or do I misunderstand the nature of your .pm file?

    Anyway, read up on "use utf8" and "no utf8", to see if that is instructive. Does your code deal with unicode characters? With other character sets that go beyond ASCII? (Do you use accented Latin1 characters in your variable names?)

Re: Unrecognised characters
by dmitri (Priest) on Dec 13, 2002 at 02:56 UTC
    a) Could you please post the code (or just several lines), and
    b) did you try hexedit?