Skip to content

Instantly share code, notes, and snippets.

@antop-dev
Created October 13, 2020 07:22
Show Gist options
  • Select an option

  • Save antop-dev/36fbe3c2cb40ec7d01146858055d5f2d to your computer and use it in GitHub Desktop.

Select an option

Save antop-dev/36fbe3c2cb40ec7d01146858055d5f2d to your computer and use it in GitHub Desktop.
나는 UTF-8을 사용하고 외부에서 EUC-KR로 요청이 올 때 받기
import org.springframework.web.filter.CharacterEncodingFilter;
public class EucKrEncodingFilter extends CharacterEncodingFilter {
public EucKrEncodingFilter() {
setEncoding("EUC-KR");
setForceEncoding(true);
}
}
import org.springframework.context.annotation.Configuration;
@Configuration
public class WebConfig {
@Bean
FilterRegistrationBean<EucKrEncodingFilter> eucKrEncodingFilter() {
FilterRegistrationBean<EucKrEncodingFilter> registrationBean = new FilterRegistrationBean<>();
registrationBean.setFilter(new EucKrEncodingFilter());
registrationBean.addUrlPatterns("/this-url");
return registrationBean;
}
}
@antop-dev
Copy link
Author

한글이 깨지는 걸 해결할 수 있다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment