From 04cdf0be240bfa90783512a064dc058415e4b787 Mon Sep 17 00:00:00 2001 From: Alex Schroeder Date: Fri, 25 May 2012 17:41:01 +0200 Subject: [PATCH] Fixed cookie decoding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the username contained a non-ASCII character, eg. Schröder, then the script would keep printing the cookie message, telling the user that the cookie had changed when in fact it had not. --- wiki.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wiki.pl b/wiki.pl index 9074a1e9..738376ed 100755 --- a/wiki.pl +++ b/wiki.pl @@ -2265,6 +2265,7 @@ sub CookieData { foreach my $key (keys %CookieParameters) { my $default = $CookieParameters{$key}; my $value = GetParam($key, $default); + utf8::encode($value); $params{$key} = $value if $value ne $default; # The cookie is considered to have changed under the following # condition: If the value was already set, and the new value is @@ -2281,7 +2282,6 @@ sub Cookie { my ($changed, $visible, %params) = CookieData(); # params are URL encoded if ($changed) { my $cookie = join(UrlEncode($FS), %params); # no CTL in field values - utf8::encode($cookie); my $result = $q->cookie(-name=>$CookieName, -value=>$cookie, -expires=>'+2y'); $Message .= $q->p(T('Cookie: ') . $CookieName . ', '