gnodet commented on PR #2955: URL: https://github.com/apache/cxf/pull/2955#issuecomment-4054178187
@reta Good question! The `charset` parameter with `application/x-www-form-urlencoded` is actually quite common in practice: 1. **jQuery** sends `application/x-www-form-urlencoded; charset=UTF-8` by default in `$.ajax()` — this is extremely widespread. 2. **CXF's own test suite** already handles this — `FormEncodingProviderTest` tests with both `charset=ISO-8859-1` ([line 264](https://github.com/apache/cxf/blob/main/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/FormEncodingProviderTest.java#L264)) and `charset=UTF-8` ([line 283](https://github.com/apache/cxf/blob/main/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/FormEncodingProviderTest.java#L283)), specifically for decoding non-ASCII characters (e.g. Chinese characters). So `FormEncodingProvider.readFrom()` already correctly uses the charset parameter. 3. **The inconsistency**: without the `startsWith` change, `isFormPostRequest()` returns `false` when a client sends `charset=UTF-8`, causing form data to not be recognized — even though the rest of CXF (`FormEncodingProvider`) properly handles it. While URL-encoding restricts the bytes on the wire to ASCII, the charset parameter tells the server how to decode percent-encoded sequences back to characters (e.g. `name=%E4%B8%AD%E6%96%87` decodes differently with UTF-8 vs ISO-8859-1). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
