Commit | Line | Data |
5ab21903 |
1 | package TestAppEncoding::Controller::Root; |
2 | use strict; |
3 | use warnings; |
4 | use base 'Catalyst::Controller'; |
5 | use Test::More; |
6 | |
7 | __PACKAGE__->config->{namespace} = ''; |
8 | |
9 | sub binary : Local { |
10 | my ($self, $c) = @_; |
4a64c27b |
11 | $c->res->content_type('image/gif'); |
b9b257cc |
12 | $c->res->body(do { |
a8946dc8 |
13 | open(my $fh, '<', $c->path_to('..', '..', 'catalyst_130pix.gif')) or die $!; |
efcb1ae7 |
14 | binmode($fh); |
15 | local $/ = undef; <$fh>; |
16 | }); |
5ab21903 |
17 | } |
18 | |
19 | sub binary_utf8 : Local { |
20 | my ($self, $c) = @_; |
21 | $c->forward('binary'); |
22 | my $str = $c->res->body; |
23 | utf8::upgrade($str); |
24 | ok utf8::is_utf8($str), 'Body is variable width encoded string'; |
25 | $c->res->body($str); |
26 | } |
27 | |
d9669e44 |
28 | # called by t/aggregate/catalyst_test_utf8.t |
29 | sub utf8_non_ascii_content : Local { |
30 | use utf8; |
31 | my ($self, $c) = @_; |
32 | |
33 | my $str = 'ʇsʎlɐʇɐɔ'; # 'catalyst' flipped at http://www.revfad.com/flip.html |
34 | ok utf8::is_utf8($str), '$str is in UTF8 internally'; |
4a64c27b |
35 | |
36 | $c->res->content_type('text/plain'); |
d9669e44 |
37 | $c->res->body($str); |
38 | } |
39 | |
40 | |
5ab21903 |
41 | sub end : Private { |
42 | my ($self,$c) = @_; |
43 | } |
44 | |
45 | 1; |