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 |
|
|
my $s = q[<!DOCTYPE HTML> |
18 |
|
|
<script charset=utf-8 src="../../../support/result0.js"></script> |
19 |
|
|
<script charset=utf-8 src="../../../support/result.js"></script> |
20 |
|
|
|
21 |
|
|
<h1>Before <code>onload</code></h1> |
22 |
|
|
<noscript>FAIL (noscript)</noscript> |
23 |
|
|
<script> |
24 |
|
|
document.write ('<p><code>document.charset</code>: '); |
25 |
|
|
writeResult (document.charset); |
26 |
|
|
|
27 |
|
|
document.write ('<p><code>document.characterSet</code>: '); |
28 |
|
|
writeResult (document.characterSet); |
29 |
|
|
|
30 |
|
|
document.write ('<p><code>document.inputEncoding</code>: '); |
31 |
|
|
writeResult (document.inputEncoding); |
32 |
|
|
|
33 |
|
|
document.write ('<hr>'); |
34 |
|
|
|
35 |
|
|
document.write ('<p><code>document.defaultCharset</code>: '); |
36 |
|
|
writeResult (document.defaultCharset); |
37 |
|
|
|
38 |
|
|
document.write ('<p><code>document.xmlEncoding</code>: '); |
39 |
|
|
writeResult (document.xmlEncoding); |
40 |
|
|
|
41 |
|
|
window.onload = function () { |
42 |
|
|
setResult ('result-charset', document.charset); |
43 |
|
|
setResult ('result-characterSet', document.characterSet); |
44 |
|
|
setResult ('result-inputEncoding', document.inputEncoding); |
45 |
|
|
setResult ('result-defaultCharset', document.defaultCharset); |
46 |
|
|
setResult ('result-xmlEncoding', document.xmlEncoding); |
47 |
|
|
}; |
48 |
|
|
</script> |
49 |
|
|
|
50 |
|
|
<h1>After <code>onload</code></h1> |
51 |
|
|
|
52 |
|
|
<p><code>document.charset</code>: <span id=result-charset></span> |
53 |
|
|
<p><code>document.characterSet</code>: <span id=result-characterSet></span> |
54 |
|
|
<p><code>document.inputEncoding</code>: <span id=result-inputEncoding></span> |
55 |
|
|
<hr> |
56 |
|
|
<p><code>document.defaultCharset</code>: <span id=result-defaultCharset></span> |
57 |
|
|
<p><code>document.xmlEncoding</code>: <span id=result-xmlEncoding></span> |
58 |
|
|
]; |
59 |
|
|
|
60 |
|
|
|
61 |
|
|
print $s; |