Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^4: replace string

by sandy1028 (Sexton)
on May 18, 2009 at 09:32 UTC ( #764609=note: print w/ replies, xml ) Need Help??


in reply to Re^3: replace string
in thread replace string

How to encode or decode ’ to ’


Comment on Re^4: replace string
Re^5: replace string
by Anonymous Monk on May 18, 2009 at 09:36 UTC
    Buy an encoder?
Re^5: replace string
by ig (Vicar) on May 18, 2009 at 10:37 UTC

    If you provide sample data you may get more specific guidance. Your description is a bit too vague for anyone to be certain what you have as input and what you want as output. There are many possibilities.

    In addition to the suggestions already given, you may find perlunifaq and Encode helpful. I suspect you don't need Encode for what you are trying to do, but these will give you terminology and context to help you understand about encodings in general and about perl's internal representation of strings, which may be what you are trying to manipulate.

    Perl regular expressions support escape sequences that allow you to specify fairly arbitrary values in your string, including Unicode code points.

    \033 octal char (example: ESC) \x1B hex char (example: ESC) \x{263a} long hex char (example: Unicode SMILEY) \cK control char (example: VT) \N{name} named Unicode character

    It may be that all you need to do is specify the correct characters in your RE, using one of the escapes (probably long hex char or named Unicode character, depending on your preference). But it is possible you will have to decode your input first.

    If you use Devel::Peek's Dump to dump your input data and post that, then you might get more specific advice.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2014-07-11 00:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (217 votes), past polls