Parameters encoding wrong
-------------------------
Key: SLING-1845
URL: https://issues.apache.org/jira/browse/SLING-1845
Project: Sling
Issue Type: Bug
Components: Engine
Affects Versions: Commons Mime 2.1.2
Environment: Mac OS
Reporter: Pierre-Luc Rigaux
Hello here my problem,
I try to post some parameters in different languages and the output is wrong.
Here my exemple.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<title>Test Parameters</title>
</head>
<body>
Test Parm
<form action="/test/encoding" method="POST"
enctype="application/x-www-form-urlencoded">
<input type="hidden" name="property/en" value="School">
<input type="hidden" name="property/fr" value="École">
<input type="hidden" name="property/zh" value="学校">
<input type="hidden" name="school" value="School">
<input type="hidden" name="école" value="École">
<input type="hidden" name="学校" value="学校">
<button type="submit">Submit</button>
</form>
</body>
</html>
Here the HTTP headers
Response Headers
Content-Type text/html; charset=utf-8
Server Jetty(6.1.x)
Transfer-Encoding chunked
Proxy-Connection Keep-alive
Request Headers
Host localhost:8888
User-Agent Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US;
rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive 115
Proxy-Connection keep-alive
Referer http://localhost:8888/client/testParameters.html
Cookie
sling.formauth=MTQyMTUxODdiYTI5YTI5ZTYzN2IwNmU4M2ZiYjQ2YThiMjZmOWIzYkA0MTI4NzE2MzQ5Nzg0NkBhZG1pbg
Here the POST
Parameters application/x-www-form-urlencoded
property/en School
property/fr École
property/zh 学校
school School
école École
学校 学校
Content-Type: application/x-www-form-urlencoded
Content-Length: 152
property%2Fen=School&property%2Ffr=%C3%89cole&property%2Fzh=%E5%AD%A6%E6%A0%A1&school=School&%C3%A9cole=%C3%89cole&%E5%AD%A6%E6%A0%A1=%E5%AD%A6%E6%A0%A1
Here my analysis
The problem is due to the method
org.apache.sling.engine.impl.parameters.ParameterSupport.getRequestParameterMapInternal()
that call the Util.fixEncoding(parameters);
Before calling that method all the values are OK but after they are encoded in
ISO-8859-1. To fix the problem I send an other parameter _charset_=utf-8. But I
think that is the wrong way to do it.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.