X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FReaction%2FUI%2FWindow.pm;h=876a2868137877261944fb9194f93ab91630cf08;hb=4edebf11a6eb893a7dea6aedd7565497b8907b6b;hp=5eda757c2b2b50e06de76b10ede8c2e9e41b67df;hpb=bdfdc97f2f79c7072b5d288344775b9d48968941;p=catagits%2FReaction.git diff --git a/lib/Reaction/UI/Window.pm b/lib/Reaction/UI/Window.pm index 5eda757..876a286 100644 --- a/lib/Reaction/UI/Window.pm +++ b/lib/Reaction/UI/Window.pm @@ -50,15 +50,23 @@ sub flush_events { foreach my $type (qw/query body/) { my $meth = "${type}_parameters"; - my $param_hash = $ctx->req->$meth; - $self->focus_stack->apply_events($param_hash) - if keys %$param_hash; + my $param_hash = { %{$ctx->req->$meth} }; # yeah, FocusStack deletes it + my @param_keys = keys %$param_hash; + if (@param_keys) { + for (@param_keys) { + utf8::decode($param_hash->{$_}) + unless (utf8::is_utf8($param_hash->{$_})); + } + $self->focus_stack->apply_events($param_hash); + } } }; sub flush_view { my ($self) = @_; my $res = $self->ctx->res; - $res->body($self->view->render_window($self)); + my $res_body = $self->view->render_window($self); + utf8::encode($res_body) if utf8::is_utf8($res_body); + $res->body($res_body); $res->content_type($self->content_type); };