in reply to Decode umlauts on CGI-parameters
I store the text in db like this: "Benutzer%20l%26ouml%3Bschen" (uriescaped_utf8), when I receive it, I uriunescape it and then I compare...It looks like the value stored in the database contains a HTML Entity, so when you retrieve and uri_unescape it, it is "Benutzer löschen", not "Benutzer löschen".
It looks correct when you print it out to the browser, but if you view the source of the HTML you will see the problem.uri_unescape( Benutzer%20l%26ouml%3Bschen ) => Benutzer löschen and uri_escape( Benutzer löschen ) => Benutzer%20l%F6schen uri_escape( Benutzer löschen ) => Benutzer%20l%26ouml%3Bschen
One way to solve it is to html decode the value before making the comparison:
In the future, when you are saving the values to the database, you could remove the entities before uri_escape.use URI::Escape; use HTML::Entities; my $db_value = uri_unescape( $aText{'1530'} ); decode_entities( $db_value ); if ( $p_sAction eq $db_value ) { ...
Update: minor edits.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Decode umlauts on CGI-parameters
by Yaerox (Scribe) on Jul 17, 2015 at 08:23 UTC |