250x250
Notice
Recent Posts
Recent Comments
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 |
Tags
- git
- spring
- Docker
- myBatis
- PostgreSQL
- MSSQL
- Open Source
- 설정
- Python
- Eclipse
- AJAX
- STS
- JDBC
- Core Java
- JavaScript
- Tomcat
- Spring Boot
- oracle
- SpringBoot
- Exception
- 오픈소스
- ubuntu
- 문서
- Source
- Thymeleaf
- error
- MySQL
- maven
- IntelliJ
- jpa
Archives
- Today
- Total
헤르메스 LIFE
[Source] Character Set Conversion 본문
728x90
/**
* Character Set를 ISO-8859-1로 컨버전
* @param str 변환할 문자
* @return String 변환문자
*/
public String convISO(String str) {
String tmp = new String("");
if(str==null||str.length()==0) return "";
try {
tmp = new String(str.getBytes("EUC-KR"), "ISO-8859-1");
} catch (UnsupportedEncodingException uee) {
log(CLASS_NAME + ".convISO()","Character Set변환을 실패했습니다."+uee.toString());
} catch (Exception e) {
log(CLASS_NAME + ".convISO()","에러가 발생했습니다."+e.toString());
}
return tmp;
}
/**
* Character Set를 EUC-KR로 컨버전
* @param str 변환할 문자
* @return String 변환문자
*/
public String convEUC(String str) {
String tmp = new String("");
if(str==null||str.length()==0) return "";
try {
tmp = new String(str.getBytes("ISO-8859-1"), "EUC-KR");
} catch (UnsupportedEncodingException uee) {
log(CLASS_NAME + ".convEUC()","Character Set변환을 실패했습니다."+uee.toString());
} catch (Exception e) {
log(CLASS_NAME + ".convEUC()","에러가 발생했습니다."+e.toString());
}
return tmp;
}
public static String U2K(String str) {
try {
if( str == null || str.equals(""))
return null;
return new String(str.getBytes("UTF8"),"KSC5601");
}catch(UnsupportedEncodingException e) { return null;}
}
/**
* 주어진 문자열을 한글로 변환한다(KSC5601)
*
* @param String KORStr
* @return String ENGStr
*/
public static String E2K(String str) {
try {
if( str == null || str.equals(""))
return null;
return new String(str.getBytes("8859_1"),"KSC5601");
}
catch(UnsupportedEncodingException e) { return null;}
}
/**
* 주어진 문자열을 영문으로 변환한다(8859_1)
*
* @param String ENGStr
* @return String KORStr
*/
public static String K2E(String str) {
try {
if( str == null || str.equals(""))
return null;
return new String(str.getBytes("KSC5601"),"8859_1");
}
catch(UnsupportedEncodingException e) { return null;}
}
728x90
'Core Java' 카테고리의 다른 글
| [Source] Unicode 1.2를 Unicode 2.0 으로 변환 (0) | 2010.10.20 |
|---|---|
| [Source] Unicode 2.0 을 Unicode 1.2 로 변환 (0) | 2010.10.20 |
| [Source] String to Unicode (0) | 2010.10.20 |
| [Source] Unicode To String (0) | 2010.10.20 |
| [Source] CVS 폴더 삭제 (0) | 2010.09.06 |