Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://788963]
help
Chatterbox?
[ambrus]: Corion: really? Does that mean the Prima watcher objects behave as handles that stop the watcher when they're destroyed, just like AnyEvent expects?
[ambrus]: "all the bugs" -- hehe, good luck
[ambrus]: Corion: what I don't understand is, if you make a one-shot AnyEvent timer with short timeout, does this code guarantee that the Prima timer can't queue two timeout events before invoking any of them?
[ambrus]: Because that could break AnyEvent code, which is why I added a guard.
[ambrus]: (It might be easier to use the callback scalar as a guard, as in $c and &$c(); $c = ();)

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2016-12-09 09:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (150 votes). Check out past polls.