Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: Replacing non ascii in string

by Anonymous Monk
on Jan 31, 2013 at 08:41 UTC ( #1016255=note: print w/replies, xml ) Need Help??


in reply to Re^2: Replacing non ascii in string
in thread Replacing non ascii in string

Sounds like an encoding problem. Is your string utf-8? (Encode, $decoded_str = decode('utf-8', $str)) Did you use utf8 to get your literals parsed as such?

(You see, those fancy apostrophes are represented as three bytes. If Perl thinks we're still in ascii-land (binary-land), it sees the transliteration as tr/\xe2\x80\x99/'/ -- effectively changing any of those three bytes to an apostrophe.)

Replies are listed 'Best First'.
Re^4: Replacing non ascii in string
by IanD (Initiate) on Feb 05, 2013 at 05:54 UTC

    Bingo - that makes sense.

    Sorted now, thanks for your assistance.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2019-08-19 02:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If you were the first to set foot on the Moon, what would be your epigram?






    Results (136 votes). Check out past polls.

    Notices?