Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: utf8 characters in tr/// or s///

by ikegami (Patriarch)
on Oct 01, 2008 at 02:16 UTC ( [id://714698]=note: print w/replies, xml ) Need Help??


in reply to utf8 characters in tr/// or s///

I assumed I needed "use utf8" as the Š characters are "in the code"

If your source file is UTF-8 encoded, you do. It decodes it.

but if I uncomment "use utf8", none of the translations or substitions have any effect, I just print out the original text each time.

I agree with moritz. That means the database is returning the strings encoded. You need to decode them.

my $p = $sth->fetchrow_hashref; utf8::decode( $p->{town} ); my $town = $p->{town};

(The "utf8::" functions are always present. No need to "use" anything.)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2024-04-25 20:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found