6 use WgetFeature qw(iri);
9 # cf. http://en.wikipedia.org/wiki/Latin1
10 # http://en.wikipedia.org/wiki/ISO-8859-15
12 ###############################################################################
13 # Force remote encoding to ISO-8859-1
15 # mime : charset found in Content-Type HTTP MIME header
16 # meta : charset found in Content-Type meta tag
18 # index.html mime + file = iso-8859-15
19 # p1_français.html meta + file = iso-8859-1, mime = utf-8
20 # p2_één.html mime + file = iso-8859-1
21 # p3_€€€.html meta + file = utf-8, mime = iso-8859-1
24 my $ccedilla_l15 = "\xE7";
25 my $ccedilla_u8 = "\xC3\xA7";
26 my $eacute_l1 = "\xE9";
27 my $eacute_u8 = "\xC3\xA9";
28 my $eurosign_l15 = "\xA4";
29 my $eurosign_u8 = "\xE2\x82\xAC";
30 my $currency_l1 = "\xA4";
31 my $currency_u8 = "\xC2\xA4";
33 my $pageindex = <<EOF;
36 <title>Main Page</title>
40 Link to page 1 <a href="http://localhost:{{port}}/p1_fran${ccedilla_l15}ais.html">La seule page en français</a>.
41 Link to page 3 <a href="http://localhost:{{port}}/p3_${eurosign_l15}${eurosign_l15}${eurosign_l15}.html">My tailor is rich</a>.
47 my $pagefrancais = <<EOF;
50 <title>La seule page en français</title>
51 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
55 Link to page 2 <a href="http://localhost:{{port}}/p2_${eacute_l1}${eacute_l1}n.html">Die enkele nerderlangstalige pagina</a>.
64 <title>Die enkele nederlandstalige pagina</title>
68 Één is niet veel maar toch meer dan nul.<br/>
69 Nerdelands is een mooie taal... dit zin stuckje spreekt vanzelf, of niet :)
78 <title>Euro page</title>
82 My tailor isn't rich anymore.
101 # code, msg, headers, content
107 "Content-type" => "text/html; charset=ISO-8859-15",
109 content => $pageindex,
115 "Content-type" => "text/plain",
119 '/p1_fran%C3%A7ais.html' => { # UTF-8 encoded
121 msg => "File not found",
123 "Content-type" => "text/html; charset=UTF-8",
127 '/p1_fran%E7ais.html' => {
131 "Content-type" => "text/html; charset=UTF-8",
133 content => $pagefrancais,
135 '/p2_%C3%A9%C3%A9n.html' => { # UTF-8 encoded
139 "Content-type" => "text/html; charset=UTF-8",
143 '/p2_%E9%E9n.html' => {
147 "Content-type" => "text/html; charset=ISO-8859-1",
151 '/p3_%E2%82%AC%E2%82%AC%E2%82%AC.html' => { # UTF-8 encoded
155 "Content-type" => "text/plain",
157 content => $pageeuro,
159 '/p3_%A4%A4%A4.html' => {
163 "Content-type" => "text/plain",
165 content => $pageeuro,
167 '/p3_%C2%A4%C2%A4%C2%A4.html' => { # UTF-8 encoded
171 "Content-type" => "text/plain",
173 content => $pageeuro,
177 my $cmdline = $WgetTest::WGETPATH . " --iri --remote-encoding=iso-8859-1 -nH -r http://localhost:{{port}}/";
179 my $expected_error_code = 0;
181 my %expected_downloaded_files = (
183 content => $pageindex,
188 "p1_fran${ccedilla_l15}ais.html" => {
189 content => $pagefrancais,
191 "p2_${eacute_u8}${eacute_u8}n.html" => {
194 "p3_${currency_u8}${currency_u8}${currency_u8}.html" => {
195 content => $pageeuro,
199 ###############################################################################
201 my $the_test = HTTPTest->new (name => "Test-iri-forced-remote",
204 errcode => $expected_error_code,
205 output => \%expected_downloaded_files);
206 exit $the_test->run();