<head><meta charset="utf-8"></head>
<body>
<p>Test how URLs are encoded.</p>
<ol id=result></ol>
<script>
    function log(message)
    {
        var item = document.createElement("li");
        item.appendChild(document.createTextNode(message));
        document.getElementById("result").appendChild(item);
    }

    if (window.testRunner)
        testRunner.dumpAsText();

    var req = new XMLHttpRequest;
    req.open("GET", "/xmlhttprequest/resources/print-query.cgi?Проверка", false);
    req.send();
    log("abs-path: " + (req.responseText == "%D0%9F%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B0" ? "PASS" : "FAIL (" + req.responseText + ")"));

    req.open("GET", "resources/print-query.cgi?Проверка", false);
    req.send();
    log("rel-path: " + (req.responseText == "%D0%9F%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B0" ? "PASS" : "FAIL (" + req.responseText + ")"));

    req.open("GET", document.URL.replace(/encode-request-url\.html/, "") + "resources/print-query.cgi?Проверка", false);
    req.send();
    log("absolute: " + (req.responseText == "%D0%9F%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B0" ? "PASS" : "FAIL (" + req.responseText + ")"));
</script>
</body>
