I'm not sure that your incoming strings will be UTF-8, or rather, the incoming strings might contain UTF-8 but they might not be tagged with the utf8 flag in Perl. It's much of guesswork what encoding browsers use on form submissions - a rule of thumb is that the browser might use the same encoding the page was sent with... So inspect the bytes you get back and maybe manually switch the UTF-8 flag on on your $nachname variable - then the (utf8) regex should/could/might actually match. You could also enlist the help of demerphq :)
If that approach of tagging (or encoding) the data fails, maybe turn the regex around and reject what is not allowed:
my @rules = ( # presuming ASCII machine # this will likely break on an EBCDIC machine [ qr/\x00-\x1f/,'Keine Steuerzeichen erlaubt' ], [ qr/\d/,'Keine Zahlen erlaubt' ], [ qr/!-@/,'Keine Sonderzeichen erlaubt' ], [ qr/\[-`~/,'Keine Sonderzeichen erlaubt' ], # ... ); for (@rules) { my ($rule,$message) = @$_; if ($nachname =~ /$rule/) { die $message; }; };
In reply to Re: WebApps and Encoding
by Corion
in thread WebApps and Encoding
by holli
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |