Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
There's more than one way to do things
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2014-04-17 04:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (439 votes), past polls