in reply to WebApps and Encoding
converting your input to iso-8859-1 (a.k.a latin-1) via Encode will help. Here's a minimal CGI:
#!/usr/bin/perl use CGI; use Encode qw(from_to);; use strict; my $q = CGI->new; my ( $name, $result); if ( $name = $q -> param ('name')) { my $tmp = $name; from_to ( $tmp,"utf-8","iso-8859-1"); $result = $tmp =~ /^\w[\w\s\-äÄöÖüÜ]+$/ ? 'ok' : 'failed'; } print $q -> header (-charset => 'utf-8'); print <<EOH; <html> <head> <title>Foo</title> <body> <form name="foo" method="post"> Name: <input name="name" /> <input type="submit" value="send" /> </form>Name: $name, parsing: $result </body> </head> </html> EOH
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|