diff options
author | xinming <xinming@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2009-07-29 05:10:29 +0000 |
---|---|---|
committer | xinming <xinming@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2009-07-29 05:10:29 +0000 |
commit | 4edebf11a6eb893a7dea6aedd7565497b8907b6b (patch) | |
tree | 7983ce6febadc57085bbf19c8467af4d67a0bf96 | |
parent | 81cb15f7aa10244bab691f3beb48ff71aa6dd7ac (diff) | |
download | reaction-4edebf11a6eb893a7dea6aedd7565497b8907b6b.tar.gz reaction-4edebf11a6eb893a7dea6aedd7565497b8907b6b.zip |
Merge branch utf8_support branch (r1109:1112) into trunk.
-rw-r--r-- | lib/Reaction/UI/LayoutSet.pm | 2 | ||||
-rw-r--r-- | lib/Reaction/UI/Window.pm | 14 |
2 files changed, 13 insertions, 3 deletions
diff --git a/lib/Reaction/UI/LayoutSet.pm b/lib/Reaction/UI/LayoutSet.pm index a976d5b..1ebc646 100644 --- a/lib/Reaction/UI/LayoutSet.pm +++ b/lib/Reaction/UI/LayoutSet.pm @@ -55,6 +55,8 @@ sub has_layout { exists $_[0]->layouts->{$_[1]} }; sub _load_file { my ($self, $file, $build_args) = @_; my $data = $file->slurp; + utf8::decode($data) + unless utf8::is_utf8($data); my $layouts = $self->layouts; # cheesy match for "=for layout name ... =something" # final split group also handles last in file, (?==) is lookahead diff --git a/lib/Reaction/UI/Window.pm b/lib/Reaction/UI/Window.pm index 610a935..876a286 100644 --- a/lib/Reaction/UI/Window.pm +++ b/lib/Reaction/UI/Window.pm @@ -51,14 +51,22 @@ sub flush_events { foreach my $type (qw/query body/) { my $meth = "${type}_parameters"; my $param_hash = { %{$ctx->req->$meth} }; # yeah, FocusStack deletes it - $self->focus_stack->apply_events($param_hash) - if keys %$param_hash; + 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); }; |