File: not_utf8_query_bug.t

package info (click to toggle)
libcatalyst-perl 5.90132-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,016 kB
  • sloc: perl: 11,061; makefile: 7
file content (45 lines) | stat: -rw-r--r-- 960 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use utf8;
use warnings;
use strict;

# For reported: https://rt.cpan.org/Ticket/Display.html?id=103063

{
  package MyApp::Controller::Root;
  $INC{'MyApp/Controller/Root.pm'} = __FILE__;

  use base 'Catalyst::Controller';

  sub example :Local Args(0) {
    pop->stash->{testing1} = 'testing2';
  }

  package MyApp;
  use Catalyst;

  #MyApp->config(decode_query_using_global_encoding=>1, encoding => 'SHIFT_JIS');
  #MyApp->config(do_not_decode_query=>1);
  #MyApp->config(decode_query_using_global_encoding=>1, encoding => undef);
  MyApp->config(default_query_encoding=>'SHIFT_JIS');

  MyApp->setup;
}

use Test::More;
use Catalyst::Test 'MyApp';
use Encode;
use HTTP::Request::Common;

{
  my $shiftjs = 'test ใƒ†ใ‚นใƒˆ';
  my $encoded = Encode::encode('SHIFT_JIS', $shiftjs);

  ok my $req = GET "/root/example?a=$encoded";
  my ($res, $c) = ctx_request $req;

  is $c->req->query_parameters->{'a'}, $shiftjs, 'got expected value';
}


done_testing;