Find the answer to your Linux question:
Results 1 to 4 of 4
Dear all, Running a perl script to a text file I get the following error "Unrecognized character \xC3; marked by <-- HERE after Tac<-- HERE". Basically, I have a portugese ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2012
    Posts
    53

    perl - Unrecognized character \xC3; marked by <-- HERE after Tac<--


    Dear all,
    Running a perl script to a text file I get the following error "Unrecognized character \xC3; marked by <-- HERE after Tac<-- HERE". Basically, I have a portugese text and using this script I need to replace a text with a new one. Given that the text is in portugese, there are some special caracters such as ş,,,. I had also the same poblem trying to count the len of a sting because these letters were counted as two letters.

    my script looks like:
    Code:
    $data =~ s/\b\Q$oldtext\E\b/$newtext/gi;
    Could you please help me resolve this problem?

    Thanks in advance for your time.

    Cheers

  2. #2
    Linux Engineer
    Join Date
    Dec 2013
    Posts
    1,048
    As you may have guessed you have a locale issue. You'll need to tell perl how to interpret the text. This page might help you: perllocale - perldoc.perl.org

  3. #3
    Just Joined!
    Join Date
    Apr 2012
    Posts
    53
    Thanks a lot for your reply. I tried to add the
    Code:
    use locale;
    but it doesn't work. Do you have any idea?

    Thank you again for your help.

    Cheers,

  4. #4
    Linux Engineer
    Join Date
    Dec 2013
    Posts
    1,048
    I imagine you need to setLocale to whatever is appropriate for the language you are parsing. You may also be able to export your locale. This is covered further down the page I previously linked to.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •