8 # cf. http://en.wikipedia.org/wiki/Latin1
9 # http://en.wikipedia.org/wiki/ISO-8859-15
11 ###############################################################################
13 # mime : charset found in Content-Type HTTP MIME header
14 # meta : charset found in Content-Type meta tag
16 # index.html mime + file = iso-8859-15
17 # p1_français.html meta + file = iso-8859-1, mime = utf-8
18 # p2_één.html meta + file = utf-8, mime =iso-8859-1
19 # p3_€€€.html meta + file = utf-8, mime = iso-8859-1
20 # p4_méér.html mime + file = utf-8
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";
30 my $pageindex = <<EOF;
33 <title>Main Page</title>
37 Link to page 1 <a href="http://localhost:{{port}}/p1_fran${ccedilla_l15}ais.html">La seule page en français</a>.
38 Link to page 3 <a href="http://localhost:{{port}}/p3_${eurosign_l15}${eurosign_l15}${eurosign_l15}.html">My tailor is rich</a>.
44 my $pagefrancais = <<EOF;
47 <title>La seule page en français</title>
48 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
52 Link to page 2 <a href="http://localhost:{{port}}/p2_${eacute_l1}${eacute_l1}n.html">Die enkele nerderlangstalige pagina</a>.
61 <title>Die enkele nederlandstalige pagina</title>
62 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
66 Één is niet veel maar toch meer dan nul.<br/>
67 Nerdelands is een mooie taal... dit zin stuckje spreekt vanzelf, of niet :)<br/>
68 <a href="http://localhost:{{port}}/p4_m${eacute_u8}${eacute_u8}r.html">Méér</a>
77 <title>Euro page</title>
78 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
82 My tailor isn't rich anymore.
91 <title>Bekende supermarkt</title>
95 Ik ben toch niet gek !
114 # code, msg, headers, content
120 "Content-type" => "text/html; charset=ISO-8859-15",
122 content => $pageindex,
128 "Content-type" => "text/plain",
132 '/p1_fran%C3%A7ais.html' => { # UTF-8 encoded
134 msg => "File not found",
136 "Content-type" => "text/html; charset=UTF-8",
140 '/p1_fran%E7ais.html' => {
144 "Content-type" => "text/html; charset=UTF-8",
146 content => $pagefrancais,
148 '/p2_%C3%A9%C3%A9n.html' => { # UTF-8 encoded
152 "Content-type" => "text/html; charset=ISO-8859-1",
156 '/p2_%E9%E9n.html' => {
160 "Content-type" => "text/html; charset=ISO-8859-1",
164 '/p3_%E2%82%AC%E2%82%AC%E2%82%AC.html' => { # UTF-8 encoded
168 "Content-type" => "text/plain; charset=ISO-8859-1",
170 content => $pageeuro,
172 '/p3_%A4%A4%A4.html' => {
176 "Content-type" => "text/plain; charset=ISO-8859-1",
178 content => $pageeuro,
180 '/p4_m%C3%A9%C3%A9r.html' => {
184 "Content-type" => "text/plain; charset=UTF-8",
186 content => $pagemeer,
190 my $cmdline = $WgetTest::WGETPATH . " --iri --restrict-file-names=nocontrol -nH -r http://localhost:{{port}}/";
192 my $expected_error_code = 0;
194 my %expected_downloaded_files = (
196 content => $pageindex,
201 "p1_fran${ccedilla_l15}ais.html" => {
202 content => $pagefrancais,
204 "p2_${eacute_u8}${eacute_u8}n.html" => {
207 "p3_${eurosign_u8}${eurosign_u8}${eurosign_u8}.html" => {
208 content => $pageeuro,
210 "p4_m${eacute_u8}${eacute_u8}r.html" => {
211 content => $pagemeer,
215 ###############################################################################
217 my $the_test = HTTPTest->new (name => "Test-iri",
220 errcode => $expected_error_code,
221 output => \%expected_downloaded_files);
222 exit $the_test->run();