[
https://issues.apache.org/jira/browse/CXF-4499?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sergey Beryozkin resolved CXF-4499.
-----------------------------------
Resolution: Fixed
Fix Version/s: 2.7.0
2.6.3
2.5.6
2.4.10
Assignee: Sergey Beryozkin
> 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
> Assignee: Sergey Beryozkin
> Fix For: 2.4.10, 2.5.6, 2.6.3, 2.7.0
>
>
> 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