https://www.dukgun.com/2021/03/java-string-string-getbytes.html?m=1
[JAVA] String 문자열 인코딩 방법 - String getBytes()
JAVA String 문자열 인코딩 방법 - String getBytes()
www.dukgun.com
https://whitekeyboard.tistory.com/573
[Java - (17) ] String 문자열 원하는 인코딩으로 변환하기
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 String proposer = "한글 테스트"; "utf-8 -> euc-kr : " + new String(proposer.getBytes("utf-8"), "euc-kr")); "utf-8 -> ksc5601 : " + new String(proposer.getBytes("utf-8"), "ksc5601")); "utf-8 -> x-windo
whitekeyboard.tistory.com
스트링 엔코딩 변환 - euc-kr <---> utf-8
세 줄 요약. 1. JAVA 의 String 클래스는 유니코드로 처리되는 char 의 배열 이외에 어떠한 인코딩 정보를 갖고 있지 않는다. 2. String.getByte('인코딩명') 을 사용하여 인코딩 할 수 있으며, new String(byte[],
dev.re.kr
- java file save euc-kr to utf-8
https://infondgndg91.blogspot.com/2018/12/java-euc-kr-text-file-convert-to-utf-8.html
Java EUC-KR text File Convert to UTF-8 text File
ndgndg91
infondgndg91.blogspot.com
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
public class Convert {
public static void main(String[] args) throws IOException {
String path = Convert.class.getResource("").getPath();
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(path + "개인가계부.txt"), "EUC-KR"));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("utf8.txt"), "utf-8"));
String line;
while ((line = br.readLine()) != null) {
//System.out.println(line);
String utf8 = new String(line.getBytes(),"UTF-8");
System.out.println(utf8);
bw.write(utf8);
bw.newLine();
}
bw.flush();
br.close();
bw.close();
System.out.println("Done!");
}
}
'java' 카테고리의 다른 글
ThreadLocal (0) | 2022.04.29 |
---|---|
xml to json (0) | 2021.12.13 |
Changing Annotation Parameters At Runtime (0) | 2021.08.11 |
lamda (람다) 예제 (0) | 2021.04.25 |
apache commons project-random, secureRandom, 난수 (0) | 2021.03.22 |