boshi created CXF-4499:
---------------------------
Summary: wrong charset encoding in FormEncodingProvider
Key: CXF-4499
URL: https://issues.apache.org/jira/browse/CXF-4499
Project: CXF
Issue Type: Bug
Components: Core
Affects Versions: 2.2.12
Reporter: boshi
org.apache.cxf.jaxrs.provider.FormEncodingProvider
{code}
public void writeTo(Object obj, Class<?> c, Type t, Annotation[] anns,
MediaType mt, MultivaluedMap<String, Object> headers,
OutputStream os) throws IOException,
WebApplicationException {
// ....... else .....
MultivaluedMap<String, String> map = (MultivaluedMap<String,
String>)obj;
boolean encoded = AnnotationUtils.getAnnotation(anns, Encoded.class) !=
null;
String encoding = HttpUtils.getSetEncoding(mt, headers, "UTF-8");
for (Iterator<Map.Entry<String, List<String>>> it =
map.entrySet().iterator(); it.hasNext();) {
Map.Entry<String, List<String>> entry = it.next();
for (Iterator<String> entryIterator = entry.getValue().iterator();
entryIterator.hasNext();) {
String value = entryIterator.next();
os.write(entry.getKey().getBytes(encoding));
os.write('=');
String data = encoded ? value : urlEncode(value); // <--- here
urlEncode always use utf-8 , encoding get losted here
os.write(data.getBytes(encoding));
if (entryIterator.hasNext() || it.hasNext()) {
os.write('&');
}
}
}
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira