Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

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

by graff (Chancellor)
on Aug 16, 2009 at 02:42 UTC ( [id://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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-16 18:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found