Ilya Y
Ilya Y

Reputation: 854

how to set encoding utf-8 in swagger ui for v3/api-docs?

My documentation is generated using swagger UI. But I have a problem with the language. How do I set the language encoding?

v3/api-docs

enter image description here

Upvotes: 2

Views: 8696

Answers (1)

I found two answers for this question, Hope that they will help you. One is for application yaml:

server:
 servlet:
   encoding:
    force-response: true
    charset: UTF-8

https://github.com/springfox/springfox/issues/3544

And the other is this Setting charset for Open Api 3.0 / Swagger v3

@Bean
public ResourceBundleMessageSource translator() {
    ResourceBundleMessageSource source = new ResourceBundleMessageSource();
    source.setBasenames("swagger-message");
    source.setUseCodeAsDefaultMessage(true);
    source.setDefaultEncoding("utf-8");
    return source;
}

Setting charset for Open Api 3.0 / Swagger v3

Upvotes: 2

Related Questions