https://www.dukgun.com/2021/03/java-string-string-getbytes.html?m=1
https://whitekeyboard.tistory.com/573
- java file save euc-kr to utf-8
https://infondgndg91.blogspot.com/2018/12/java-euc-kr-text-file-convert-to-utf-8.html
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 |