8 # cf. http://en.wikipedia.org/wiki/Latin1
9 # http://en.wikipedia.org/wiki/ISO-8859-15
11 ###############################################################################
12 # Force remote encoding to ISO-8859-1
14 # mime : charset found in Content-Type HTTP MIME header
15 # meta : charset found in Content-Type meta tag
17 # index.html mime + file = iso-8859-15
18 # p1_français.html meta + file = iso-8859-1, mime = utf-8
19 # p2_één.html mime + file = iso-8859-1
20 # p3_€€€.html meta + file = utf-8, mime = iso-8859-1
23 my $ccedilla_l15 = "\xE7";
24 my $ccedilla_u8 = "\xC3\xA7";
25 my $eacute_l1 = "\xE9";
26 my $eacute_u8 = "\xC3\xA9";
27 my $eurosign_l15 = "\xA4";
28 my $eurosign_u8 = "\xE2\x82\xAC";
29 my $currency_l1 = "\xA4";
30 my $currency_u8 = "\xC2\xA4";
32 my $pageindex = <<EOF;
35 <title>Main Page</title>
39 Link to page 1 <a href="http://localhost:{{port}}/p1_fran${ccedilla_l15}ais.html">La seule page en français</a>.
40 Link to page 3 <a href="http://localhost:{{port}}/p3_${eurosign_l15}${eurosign_l15}${eurosign_l15}.html">My tailor is rich</a>.
46 my $pagefrancais = <<EOF;
49 <title>La seule page en français</title>
50 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
54 Link to page 2 <a href="http://localhost:{{port}}/p2_${eacute_l1}${eacute_l1}n.html">Die enkele nerderlangstalige pagina</a>.
63 <title>Die enkele nederlandstalige pagina</title>
67 Één is niet veel maar toch meer dan nul.<br/>
68 Nerdelands is een mooie taal... dit zin stuckje spreekt vanzelf, of niet :)
77 <title>Euro page</title>
81 My tailor isn't rich anymore.
100 # code, msg, headers, content
106 "Content-type" => "text/html; charset=ISO-8859-15",
108 content => $pageindex,
114 "Content-type" => "text/plain",
118 '/p1_fran%C3%A7ais.html' => { # UTF-8 encoded
120 msg => "File not found",
122 "Content-type" => "text/html; charset=UTF-8",
126 '/p1_fran%E7ais.html' => {
130 "Content-type" => "text/html; charset=UTF-8",
132 content => $pagefrancais,
134 '/p2_%C3%A9%C3%A9n.html' => { # UTF-8 encoded
138 "Content-type" => "text/html; charset=UTF-8",
142 '/p2_%E9%E9n.html' => {
146 "Content-type" => "text/html; charset=ISO-8859-1",
150 '/p3_%E2%82%AC%E2%82%AC%E2%82%AC.html' => { # UTF-8 encoded
154 "Content-type" => "text/plain",
156 content => $pageeuro,
158 '/p3_%A4%A4%A4.html' => {
162 "Content-type" => "text/plain",
164 content => $pageeuro,
166 '/p3_%C2%A4%C2%A4%C2%A4.html' => { # UTF-8 encoded
170 "Content-type" => "text/plain",
172 content => $pageeuro,
176 my $cmdline = $WgetTest::WGETPATH . " --iri --remote-encoding=iso-8859-1 -nH -r http://localhost:{{port}}/";
178 my $expected_error_code = 0;
180 my %expected_downloaded_files = (
182 content => $pageindex,
187 "p1_fran${ccedilla_l15}ais.html" => {
188 content => $pagefrancais,
190 "p2_${eacute_u8}${eacute_u8}n.html" => {
193 "p3_${currency_u8}${currency_u8}${currency_u8}.html" => {
194 content => $pageeuro,
198 ###############################################################################
200 my $the_test = HTTPTest->new (name => "Test-iri-forced-remote",
203 errcode => $expected_error_code,
204 output => \%expected_downloaded_files);
205 exit $the_test->run();