diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandler.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandler.java index 568e08b84e43..1171f94a105e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandler.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandler.java @@ -105,6 +105,8 @@ protected RouterFunction getRoutingFunction( this::renderErrorResponse); } + private static final MediaType HTML_CONTENT_TYPE = MediaType.valueOf(MediaType.TEXT_HTML_VALUE+";charset=UTF-8"); + /** * Render the error information as an HTML view. * @param request the current request @@ -115,7 +117,7 @@ protected Mono renderErrorView(ServerRequest request) { Map error = getErrorAttributes(request, includeStackTrace); HttpStatus errorStatus = getHttpStatus(error); ServerResponse.BodyBuilder responseBody = ServerResponse.status(errorStatus) - .contentType(MediaType.TEXT_HTML); + .contentType(HTML_CONTENT_TYPE); return Flux .just("error/" + errorStatus.value(), "error/" + SERIES_VIEWS.get(errorStatus.series()), "error/error")