1 |
wakaba |
1.1 |
#!/usr/bin/perl |
2 |
|
|
use strict; |
3 |
|
|
|
4 |
|
|
my $name = $ENV{PATH_INFO}; |
5 |
|
|
$name =~ s!^/!!; |
6 |
|
|
$name =~ s/%([0-9A-Fa-f]{2})/pack 'C', hex $1/ge; |
7 |
|
|
$name =~ s/[\x00-\x1F]/ /g; |
8 |
|
|
|
9 |
|
|
my $name_c = $name; |
10 |
|
|
$name_c =~ s/[\\";\x20\x7F-\xFF]//g; |
11 |
|
|
|
12 |
|
|
print "Content-Type: text/html; charset=$name_c |
13 |
|
|
|
14 |
|
|
"; |
15 |
|
|
|
16 |
|
|
|
17 |
wakaba |
1.2 |
my $s = q[<!DOCTYPE HTML>]. |
18 |
|
|
($ENV{QUERY_STRING} =~ /c1/ ? q[<meta charset=iso-8859-3>] : |
19 |
|
|
$ENV{QUERY_STRING} =~ /c2/ ? q[<meta charset=iso-8859-4>] : q[]) . |
20 |
|
|
q[<script charset=utf-8 src="../../../support/result0.js"></script> |
21 |
wakaba |
1.1 |
<script charset=utf-8 src="../../../support/result.js"></script> |
22 |
|
|
|
23 |
|
|
<h1>Before <code>onload</code></h1> |
24 |
|
|
<noscript>FAIL (noscript)</noscript> |
25 |
|
|
<script> |
26 |
|
|
document.write ('<p><code>document.charset</code>: '); |
27 |
|
|
writeResult (document.charset); |
28 |
|
|
|
29 |
|
|
document.write ('<p><code>document.characterSet</code>: '); |
30 |
|
|
writeResult (document.characterSet); |
31 |
|
|
|
32 |
|
|
document.write ('<p><code>document.inputEncoding</code>: '); |
33 |
|
|
writeResult (document.inputEncoding); |
34 |
|
|
|
35 |
|
|
document.write ('<hr>'); |
36 |
|
|
|
37 |
|
|
document.write ('<p><code>document.defaultCharset</code>: '); |
38 |
|
|
writeResult (document.defaultCharset); |
39 |
|
|
|
40 |
|
|
document.write ('<p><code>document.xmlEncoding</code>: '); |
41 |
|
|
writeResult (document.xmlEncoding); |
42 |
|
|
|
43 |
|
|
window.onload = function () { |
44 |
|
|
setResult ('result-charset', document.charset); |
45 |
|
|
setResult ('result-characterSet', document.characterSet); |
46 |
|
|
setResult ('result-inputEncoding', document.inputEncoding); |
47 |
|
|
setResult ('result-defaultCharset', document.defaultCharset); |
48 |
|
|
setResult ('result-xmlEncoding', document.xmlEncoding); |
49 |
|
|
}; |
50 |
|
|
</script> |
51 |
|
|
|
52 |
|
|
<h1>After <code>onload</code></h1> |
53 |
|
|
|
54 |
|
|
<p><code>document.charset</code>: <span id=result-charset></span> |
55 |
|
|
<p><code>document.characterSet</code>: <span id=result-characterSet></span> |
56 |
|
|
<p><code>document.inputEncoding</code>: <span id=result-inputEncoding></span> |
57 |
|
|
<hr> |
58 |
|
|
<p><code>document.defaultCharset</code>: <span id=result-defaultCharset></span> |
59 |
|
|
<p><code>document.xmlEncoding</code>: <span id=result-xmlEncoding></span> |
60 |
|
|
]; |
61 |
|
|
|
62 |
|
|
|
63 |
|
|
print $s; |