blob: a90907356bab25ce4bc31fc7c7631dec6f20c5c1 [file] [log] [blame]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=koi8-r">
</head>
<body>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
document.write("<p>Initial</p>");
document.write("<p>&nbsp;document.charset: " + document.charset + "</p>"); // MSIE
document.write("<p>&nbsp;document.defaultCharset: " + (document.defaultCharset ? "defined" : "undefined") + "</p>"); // MSIE
document.write("<p>&nbsp;document.characterSet: " + document.characterSet + "</p>"); // Firefox
document.write("<p>&nbsp;document.inputEncoding: " + document.inputEncoding + "</p>"); // DOM3
document.write("<p>Setting charset to UTF-8...</p>");
try {
document.charset = "utf-8";
document.write("<p>&nbsp;document.charset: " + document.charset + "</p>");
document.write("<p>&nbsp;document.defaultCharset: " + (document.defaultCharset ? "defined" : "undefined") + "</p>");
document.write("<p>&nbsp;document.characterSet: " + document.characterSet + "</p>");
document.write("<p>&nbsp;document.inputEncoding: " + document.inputEncoding + "</p>");
} catch (ex) {
document.write("<p>Failure</p>");
}
// throws an exception in Firefox, but JavaScriptCore seems to silently ignore assignment to read-only properties
document.write("<p>Setting characterSet to KOI8-R (expected to fail, matching Firefox)...</p>");
try {
document.characterSet = "KOI8-R";
document.write("<p>&nbsp;document.charset: " + document.charset + "</p>");
document.write("<p>&nbsp;document.defaultCharset: " + (document.defaultCharset ? "defined" : "undefined") + "</p>");
document.write("<p>&nbsp;document.characterSet: " + document.characterSet + "</p>");
document.write("<p>&nbsp;document.inputEncoding: " + document.inputEncoding + "</p>");
} catch (ex) {
document.write("<p>Failure (expected)</p>");
}
</script>
</body>
<html>