mirror of
https://github.com/HangarMC/Hangar.git
synced 2024-11-27 06:01:08 +08:00
fix: make sure string responses use utf8
This commit is contained in:
parent
f04a253f58
commit
8094d80243
@ -47,6 +47,7 @@ import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||
import org.springframework.http.client.reactive.ReactorClientHttpConnector;
|
||||
import org.springframework.http.converter.ByteArrayHttpMessageConverter;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.StringHttpMessageConverter;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
import org.springframework.scheduling.concurrent.ConcurrentTaskExecutor;
|
||||
import org.springframework.web.client.RestClient;
|
||||
@ -153,6 +154,13 @@ public class WebConfig extends WebMvcConfigurationSupport {
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
super.afterPropertiesSet();
|
||||
|
||||
for (final HttpMessageConverter<?> messageConverter : this.getMessageConverters()) {
|
||||
if (messageConverter instanceof StringHttpMessageConverter stringConverter) {
|
||||
stringConverter.setDefaultCharset(StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
|
||||
final List<HandlerMethodArgumentResolver> existingResolvers = new ArrayList<>(Objects.requireNonNull(this.getArgumentResolvers()));
|
||||
existingResolvers.addAll(0, WebConfig.this.resolvers);
|
||||
this.setArgumentResolvers(existingResolvers);
|
||||
|
@ -3,6 +3,9 @@
|
||||
###########
|
||||
server:
|
||||
port: 8080
|
||||
servlet:
|
||||
encoding:
|
||||
charset: "UTF-8"
|
||||
|
||||
spring:
|
||||
application:
|
||||
|
Loading…
Reference in New Issue
Block a user