in reply to How to Fix Character Encoding Damaged Text Using Perl?

It's gibberish, not Chinese.

Then post the BYTES not unicode codepoints

  • Comment on Re: How to Fix Character Encoding Damaged Text Using Perl?

Replies are listed 'Best First'.
Re^2: How to Fix Character Encoding Damaged Text Using Perl?
by Jim (Curate) on Jun 15, 2013 at 02:51 UTC

    I posted the Unicode code points and character names to help illustrate how the character encoding damage occurred; that is, to demonstrate the pattern.

    My problem is straightforward:  Using Perl, restore the damaged text '敒›剕䕇呎' to the original text 'Re: URGENT'.

Re^2: How to Fix Character Encoding Damaged Text Using Perl?
by Anonymous Monk on Jun 15, 2013 at 02:32 UTC
    Whoops :)
    my $bytes = encode( 'UTF-8', $perlunicodestring ); $bytes =~ s{\x52\x65\x3A\x20\x55\x52\x47\x45\x4E\x54}{Re: URGENT}g