Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

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

by Anonymous Monk
on Jun 15, 2013 at 02:29 UTC ( #1039062=note: print w/ replies, xml ) Need Help??


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?
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
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'.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1039062]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2015-07-05 21:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (68 votes), past polls