]);
+ $out->nl_text (q[Options]);
+ $out->start_tag ('div');
+
+ if ($context eq 'url') {
+ $out->start_tag ('p');
+ $out->start_tag ('label');
+ $out->start_tag ('input', type => 'checkbox', name => 'error-page',
+ value => 1,
+ ($cgi->get_parameter ('error-page')
+ ? (checked => '') : ()));
+ $out->nl_text ('Check error page');
+ $out->end_tag ('label');
+ }
+
+ $out->start_tag ('p');
+ $out->start_tag ('label');
+ $out->nl_text (q[Content type]);
+ $out->text (': ');
+ $out->select ([
+ {value => '', label => 'As specified'},
+ {value => 'application/atom+xml'},
+ {value => 'application/xhtml+xml'},
+ {value => 'application/xml'},
+ {value => 'text/html'},
+ {value => 'text/xml'},
+ {value => 'text/css'},
+ {value => 'text/cache-manifest'},
+ {value => 'text/x-webidl'},
+ ], name => 'i', selected => scalar $cgi->get_parameter ('i'));
+ $out->end_tag ('label');
+
+ if ($context ne 'text') {
+ $out->start_tag ('p');
+ $out->start_tag ('label');
+ $out->nl_text (q[Charset]);
+ $out->text (q[: ]);
+ $out->select ([
+ {value => '', label => 'As specified'},
+ {label => 'Japanese charsets', options => [
+ {value => 'Windows-31J'},
+ {value => 'Shift_JIS'},
+ {value => 'EUC-JP'},
+ {value => 'ISO-2022-JP'},
+ ]},
+ {label => 'European charsets', options => [
+ {value => 'Windows-1252'},
+ {value => 'ISO-8859-1'},
+ {value => 'US-ASCII'},
+ ]},
+ {label => 'Asian charsets', options => [
+ {value => 'Windows-874'},
+ {value => 'ISO-8859-11'},
+ {value => 'TIS-620'},
+ ]},
+ {label => 'Unicode charsets', options => [
+ {value => 'UTF-8'},
+ {value => 'UTF-8n'},
+ ]},
+ ], name => 'charset',
+ selected => scalar $cgi->get_parameter ('charset'));
+ $out->end_tag ('label');
+ }
+
+ if ($context eq 'text') {
+ $out->start_tag ('p');
+ $out->start_tag ('label');
+ $out->nl_text ('Setting innerHTML');
+ $out->text (': ');
+ $out->start_tag ('input', name => 'e',
+ value => scalar $cgi->get_parameter ('e'));
+ $out->end_tag ('label');
+ }
+
+ $out->html (q[
]);
+ }; # $options
+
+ $out->start_section (id => 'input', title => 'Input');
+
+ $out->start_section (id => 'input-url', title => 'By URL');
+ $out->start_tag ('form', action => './', 'accept-charset' => 'utf-8',
+ method => 'get');
+ $out->start_tag ('input', type => 'hidden', name => '_charset_');
+
+ $out->start_tag ('p');
+ $out->start_tag ('label');
+ $out->nl_text ('URL');
+ $out->text (': ');
+ $out->start_tag ('input',
+ name => 'uri',
+ type => 'url',
+ value => $cgi->get_parameter ('uri'));
+ $out->end_tag ('label');
+
+ $options->('url');
+
+ $out->start_tag ('p');
+ $out->start_tag ('button', type => 'submit');
+ $out->nl_text ('Check');
+
+ $out->end_tag ('form');
+ $out->end_section;
+
+ $out->end_tag ('fieldset');
+
+ ## TODO: File upload
+
+ $out->start_section (id => 'input-text', title => 'By direct input');
+ $out->start_tag ('form', action => './', 'accept-charset' => 'utf-8',
+ method => 'post');
+ $out->start_tag ('input', type => 'hidden', name => '_charset_');
+
+ $out->start_tag ('p');
+ $out->start_tag ('label');
+ $out->nl_text ('Document source to check');
+ $out->text (': ');
+ $out->start_tag ('br');
+ $out->start_tag ('textarea',
+ name => 's');
+ my $s = $cgi->get_parameter ('s');
+ $out->text ($s) if defined $s;
+ $out->end_tag ('textarea');
+ $out->end_tag ('label');
+
+ $options->('text');
+
+ $out->start_tag ('p');
+ $out->start_tag ('button', type => 'submit',
+ onclick => 'form.method = form.s.value.length > 512 ? "post" : "get"');
+ $out->nl_text ('Check');
+ $out->end_tag ('button');
+
+ $out->end_tag ('form');
+ $out->end_section;
+
+ $out->end_section;
+} # generate_input_section
+
sub encode_url_component ($$) {
shift;
require Encode;