First-time request doesn't respect XML page and Form encoding
-------------------------------------------------------------

                 Key: WICKET-1235
                 URL: https://issues.apache.org/jira/browse/WICKET-1235
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.3.0-rc2
         Environment: Windows 2000, jdk1.4.2_14-b05, Apache Tomcat 4.1.36-LE, 
Wicket 1.3.0-rc2
            Reporter: Evgeniy Karyakin


One test page with <?xml version="1.0" encoding="UTF-8"?> XML declaration in it 
(Wicket13TestHomePage.html):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns:wicket="http://wicket.sourceforge.net/";>
<head>
<title>Wicket13Test</title>
</head>
<body>
<!-- Form in question -->
<form wicket:id="testform" accept-charset="UTF-8">
<input type="text" wicket:id="inputtest"/>
<input type="submit"/>
</form>
<!-- /Form -->
</body>
</html>

WebApplication implementation set application-wide response-request encoding to 
UTF-8:

package com.example.wicket13test;
import org.apache.wicket.protocol.http.WebApplication;
public class Wicket13TestApplication extends WebApplication {
        public Wicket13TestApplication() {
        }
        public Class getHomePage() {
                return Wicket13TestHomePage.class;
        }
        public void init() {
                super.init();
                getRequestCycleSettings().setResponseRequestEncoding("UTF-8");
        }
}

FIRST browser request of http://localhost/Wicket13Test/ gives this response 
headers:

HTTP/1.x 200 OK
Server: Apache-Coyote/1.1
Pragma: no-cache
Cache-Control: no-cache, max-age=0, must-revalidate
Content-Type: text/html;charset=ISO-8859-5
Content-Language: ru-RU
Content-Length: 638
Date: Tue, 18 Dec 2007 09:31:04 GMT

That is, Content-Type is ISO-8859-5 (JVM's default?), but I assume it should 
already be UTF-8. Second and consequent requests result in proper response 
encoding: "Content-Type: text/html;charset=UTF-8". Hands-on web experience says 
that browser makes form submission using character encoding based on last 
response's setting. So this situation leads to wrong *first-time* form 
submission, but second ones are fine. In Firefox 2 form's accept-charset 
attributes helps forcibly set desired encoding, but in MSIE it doesn't.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to