according to:
http://download.oracle.com/javaee/6/api/javax/servlet/ServletRequest.html#getCharacterEncoding%28%29
request.getCharacterEncoding() should return " the name of the character
encoding used in the body of this request. ".
But request.getCharacterEncoding() always seems to return ISO-8859-1.
For example, my html.jsp looks like:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
...
<form method="POST" action="/some/path"
accept-charset="utf-8"
enctype="application/x-www-form-urlencoded; charset=utf-8">
<input type="hidden" name="_charset_" value="UTF-8" />
<input type="submit" value="Save" />
...
Then I would expect request.getCharacterEncoding() (from POST.jsp) to
return "UTF-8". But it still returns "ISO-8859-1".
Is this intended?
>From sling documentation:
http://sling.apache.org/site/request-parameters.html#RequestParameters-CharacterEncoding
I don't get this part: "This identity transformation happens to generate
strings as the original data was generated with ISO-8859-1 encoding."
As long as I set _charset_ to the encoding of the rendered page (with
<form>), I don't have a problem. But, I was wondering if
.getCharacterEncoding() should be set to whatever request body was encoded
as, not what sling used to perform "identity transform" with.
Also, wouldn't it be better if _charset_ is missing from request, it's
automatically set to request body encoding? Or, browsers don't send request
body encoding information?
Thanks.
Sam