Browse Source

Fall back on UTF-8 charset in WebClientResponseException

Instead of ISO-8859-1, consistently with the change done
in RestClientResponseException.

Closes gh-31072
pull/31466/head
Sébastien Deleuze 1 year ago
parent
commit
c6b86af78b
  1. 5
      spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClientResponseException.java

5
spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClientResponseException.java

@ -35,6 +35,7 @@ import org.springframework.util.Assert;
* Exceptions that contain actual HTTP response data. * Exceptions that contain actual HTTP response data.
* *
* @author Arjen Poutsma * @author Arjen Poutsma
* @author Sebastien Deleuze
* @since 5.0 * @since 5.0
*/ */
@SuppressWarnings("RedundantSuppression") @SuppressWarnings("RedundantSuppression")
@ -202,11 +203,11 @@ public class WebClientResponseException extends WebClientException {
/** /**
* Return the response content as a String using the charset of media type * Return the response content as a String using the charset of media type
* for the response, if available, or otherwise falling back on * for the response, if available, or otherwise falling back on
* {@literal ISO-8859-1}. Use {@link #getResponseBodyAsString(Charset)} if * {@literal UTF-8}. Use {@link #getResponseBodyAsString(Charset)} if
* you want to fall back on a different, default charset. * you want to fall back on a different, default charset.
*/ */
public String getResponseBodyAsString() { public String getResponseBodyAsString() {
return getResponseBodyAsString(StandardCharsets.ISO_8859_1); return getResponseBodyAsString(StandardCharsets.UTF_8);
} }
/** /**

Loading…
Cancel
Save