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

Re^3: UTF8 Validity

by Juerd (Abbot)
on Feb 21, 2008 at 20:02 UTC ( #669376=note: print w/ replies, xml ) Need Help??


in reply to Re^2: UTF8 Validity
in thread UTF8 Validity

Just try to decode something as UTF-8. If that fails, fall back to something else.

For example:

$foo = eval { decode("UTF-8", $foo, Encode::FB_CROAK) } || decode("CP1252", $foo);


Comment on Re^3: UTF8 Validity
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (15)
As of 2015-07-01 20:35 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 (19 votes), past polls