Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Matching/replacing a unicode character only works after decode()

by hippo (Bishop)
on Jul 25, 2014 at 10:24 UTC ( [id://1095027]=note: print w/replies, xml ) Need Help??


in reply to Matching/replacing a unicode character only works after decode()

The correct order of operations for working with encoded data (whether utf8 or any other encoding) is:

  1. Input
  2. Decode
  3. Operate
  4. Encode
  5. Output

If you don't decode your input you'll be comparing apples and elephants which is why your regex fails to match. However, if you do no operations on the data at all, then you can skip the middle three steps because your perl script in that case is just essentially a pipe between your input (eg. database) and your output (eg. web page).

This is all explained in much better detail in A UTF8 round trip with MySQL. HTH.

  • Comment on Re: Matching/replacing a unicode character only works after decode()

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-23 13:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found