X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=t%2Futf_incoming.t;h=ff61a6bfedae526f8c6f22114170c3e0f4f095c7;hp=c144a443b8f60aeb0d966037777a6bdffc7e723d;hb=9c056c82094f7550ac9e39408c52d248bcace7b3;hpb=c463b49c849c28a6fa46e9eb1c07a31b51696f1d diff --git a/t/utf_incoming.t b/t/utf_incoming.t index c144a44..ff61a6b 100644 --- a/t/utf_incoming.t +++ b/t/utf_incoming.t @@ -111,6 +111,14 @@ use Scalar::Util (); $c->response->body($contents); } + sub write_then_body :Local { + my ($self, $c) = @_; + + $c->res->content_type('text/html'); + $c->res->write("

This is early_write action ♥

"); + $c->res->body("

This is body_write action ♥

"); + } + sub file_upload :POST Consumes(Multipart) Local { my ($self, $c) = @_; Test::More::is $c->req->body_parameters->{'♥'}, '♥♥'; @@ -365,6 +373,14 @@ use Catalyst::Test 'MyApp'; } { + my $res = request "/root/write_then_body"; + + is $res->code, 200, 'OK'; + is decode_utf8($res->content), "

This is early_write action ♥

This is body_write action ♥

"; + is $res->content_charset, 'UTF-8'; +} + +{ ok my $path = File::Spec->catfile('t', 'utf8.txt'); ok my $req = POST '/root/file_upload', Content_Type => 'form-data', @@ -479,6 +495,16 @@ SKIP: { } +{ + my $shiftjs = 'test テスト'; + my $encoded = Encode::encode('UTF-8', $shiftjs); + + ok my $req = GET "/root/echo_arg?a=$encoded"; + my ($res, $c) = ctx_request $req; + + is $c->req->query_parameters->{'a'}, $shiftjs, 'got expected value'; +} + ## should we use binmode on filehandles to force the encoding...? ## Not sure what else to do with multipart here, if docs are enough...