-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancementA general enhancement
Milestone
Description
Affects: 5.x, 6.x
The default was changed for RestClientResponseException in #23764
org.springframework.web.reactive.function.client.WebClientResponseException still defaults to ISO-8859-1.
* Return the response content as a String using the charset of media type
* for the response, if available, or otherwise falling back on
* {@literal ISO-8859-1}. Use {@link #getResponseBodyAsString(Charset)} if
* you want to fall back on a different, default charset.
*/
public String getResponseBodyAsString() {
return getResponseBodyAsString(StandardCharsets.ISO_8859_1);
}
Shouldn't this also be changed to UTF-8?
Shouldn't org.springframework.web.reactive.function.client.DefaultClientResponse#createException have UTF-8 as default Charset for Responses of type "application/json"? Currently its null.
Charset charset = headers().contentType().map(MimeType::getCharset).orElse(null);
This could also solve the problem.
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancementA general enhancement