[FRAMEWORK] 스프링 한글 메시지 처리방법
1. 자바 Properties
- ISO 8859-1 문자 인코딩 사용
- 이 인코딩으로 직접 표현할 수 없는 문자는,Unicode 이스케이프를 사용해 기술
- native2ascii 툴을 사용해서 변환
- 관련 API : http://pllab.kw.ac.kr/j2seAPI/api/java/util/Properties.html
2. 유니코드(Unicode) 란?
- 컴퓨터에서 세계 각국의 언어를 통일된 방법으로 표현할 수 있게 제안된 국제적인 문자 코드 규약.
- 관련 문서 : http://100.naver.com/100.nhn?docid=719444
3. native2ascii
- native2ascii에 UTF-8 이외에 다른 encoding들을 명시할 수 있고 표준 input과 output으로 redirect할 수 있다는 것을 알아두길 바란다.
- 보통 native2ascii encoding="UTF-8" 로 사용
- 이클립스 플러그인도 내부적으로 동일
- 관련 문서 : http://java.sun.com/docs/books/jls/
4. UTF-8 이란?
- 유니코드를 표현하기 위한 방식
5. 스프링 프레임워크
5.1 org.springframework.context.support.ResourceBundleMessageSource
- This class relies on the underlying JDK's ResourceBundle implementation
- 그러므로, native2ascii 툴로 유니코드로 변환이 되어야 한글 표현이 가능
- 참고 API : http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/context/support/ResourceBundleMessageSource.html
5.2 org.springframework.context.support.ReloadableResourceBundleMessageSource
- The default strategy is capable of loading properties files with a specific character encoding
- new InputStreamReader(is, encoding) 처럼 input stream으로 읽어 옮
- Properies 파일의 text encoding을 euc-kr로 했다면 아래와 같이 defaultEncoding 값을 셋팅하면 된다.
[bean id="commons-resource-reloadable-message-source"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource"]
[property name="basenames"]
[list]
[value]WEB-INF/message-error[/value]
[/list]
[/property]
[property name="defaultEncoding" value="EUC-KR" /]
[/bean]
- ISO 8859-1 문자 인코딩 사용
- 이 인코딩으로 직접 표현할 수 없는 문자는,Unicode 이스케이프를 사용해 기술
- native2ascii 툴을 사용해서 변환
- 관련 API : http://pllab.kw.ac.kr/j2seAPI/api/java/util/Properties.html
2. 유니코드(Unicode) 란?
- 컴퓨터에서 세계 각국의 언어를 통일된 방법으로 표현할 수 있게 제안된 국제적인 문자 코드 규약.
- 관련 문서 : http://100.naver.com/100.nhn?docid=719444
3. native2ascii
- native2ascii에 UTF-8 이외에 다른 encoding들을 명시할 수 있고 표준 input과 output으로 redirect할 수 있다는 것을 알아두길 바란다.
- 보통 native2ascii encoding="UTF-8" 로 사용
- 이클립스 플러그인도 내부적으로 동일
- 관련 문서 : http://java.sun.com/docs/books/jls/
4. UTF-8 이란?
- 유니코드를 표현하기 위한 방식
5. 스프링 프레임워크
5.1 org.springframework.context.support.ResourceBundleMessageSource
- This class relies on the underlying JDK's ResourceBundle implementation
- 그러므로, native2ascii 툴로 유니코드로 변환이 되어야 한글 표현이 가능
- 참고 API : http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/context/support/ResourceBundleMessageSource.html
5.2 org.springframework.context.support.ReloadableResourceBundleMessageSource
- The default strategy is capable of loading properties files with a specific character encoding
- new InputStreamReader(is, encoding) 처럼 input stream으로 읽어 옮
- Properies 파일의 text encoding을 euc-kr로 했다면 아래와 같이 defaultEncoding 값을 셋팅하면 된다.
[bean id="commons-resource-reloadable-message-source"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource"]
[property name="basenames"]
[list]
[value]WEB-INF/message-error[/value]
[/list]
[/property]
[property name="defaultEncoding" value="EUC-KR" /]
[/bean]
댓글