Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: UTF-8: Trying to make sense of form input

by graff (Chancellor)
on Aug 16, 2009 at 02:42 UTC ( #788963=note: print w/ replies, xml ) Need Help??

in reply to UTF-8: Trying to make sense of form input

When you intend to send utf8 character data back to the client browser from a cgi script, you really should do this at the very start:

binmode STDOUT, ":utf8";
and make sure that strings coming from the script itself, or from server-side resources (files, database or whatever) are likewise properly flagged as (known to be) utf8 strings.

When you are getting utf8 characters in form data from the client browser, you have to use the Encode module -- decode('utf8',$cgi->param('foo')) -- as indicated in the replies above, so that the parameter value will be treated correctly by perl as a utf8 string.

Comment on Re: UTF-8: Trying to make sense of form input
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2015-10-10 07:45 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (255 votes), past polls