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".
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
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.

One way to solve it is to html decode the value before making the comparison:

use URI::Escape; use HTML::Entities; my $db_value = uri_unescape( $aText{'1530'} ); decode_entities( $db_value ); if ( $p_sAction eq $db_value ) { ...
In the future, when you are saving the values to the database, you could remove the entities before uri_escape.

Update: minor edits.


In reply to Re: Decode umlauts on CGI-parameters by tangent
in thread Decode umlauts on CGI-parameters by Yaerox

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.