인코딩 지옥탈출 가이드
깨지는 모양으로 인코딩 판별하기
이미지는 생각나면 추가
가오리 : EUC-KR을 UTF-8로 인식하고 열면
수식 : UTF-LATIN1 으로 인식하고 열면
외계어 :
쫩쫠뻴 : utf를 EUC로 인식하고 열면
참고
한글 인코딩의 역사
http://blog.daum.net/_blog/BlogTypeView.do?blogid=0LMWJ&articleno=8181316
http://blog.daum.net/_blog/BlogTypeView.do?blogid=0LMWJ&articleno=8181317
한글 인코딩 - 개념
https://ko.wikipedia.org/wiki/%ED%95%9C%EA%B8%80_%EC%99%84%EC%84%B1%ED%98%95_%EC%9D%B8%EC%BD%94%EB%94%A9
https://namu.wiki/w/%ED%95%9C%EA%B8%80%20%EC%9D%B8%EC%BD%94%EB%94%A9
http://d2.naver.com/helloworld/19187
http://studyforus.tistory.com/167
http://mwultong.blogspot.com/2006/12/hwp-unicode-utf-8.html
https://ko.wikipedia.org/wiki/UTF-8
http://ssaemo.tistory.com/28
https://encoder.mattiasgeniar.be/index.php
https://docs.python.org/3/howto/unicode.html#encodings
코드
어디거 퍼온거 합쳐놓은거
import java.io.*;
/** * @author chaeeung.e * @since 2017-08-08 */ public class EncodingCheck2 {
private final static char\[\] hexArray = "0123456789ABCDEF".toCharArray();
public static String bytesToHex(byte\[\] bytes) {
char\[\] hexChars = new char\[bytes.length \* 2\];
for ( int j = 0; j < bytes.length; j++ ) {
int v = bytes\[j\] & 0xFF;
hexChars\[j \* 2\] = hexArray\[v >>> 4\];
hexChars\[j \* 2 + 1\] = hexArray\[v & 0x0F\];
}
return new String(hexChars);
}
public static void main(String\[\] args) throws IOException {
File file = new File("B:\\\\test\\\\test22.txt");
BufferedReader reader=new BufferedReader(new InputStreamReader(new FileInputStream(file)));
reader.readLine();
reader.readLine();
reader.readLine();
reader.readLine();
reader.readLine();
String str = new String(reader.readLine());
String\[\] charSet = {"utf-8", "euc-kr", "ksc5601", "iso-8859-1", "x-windows-949"};
for(int i=0; i<charSet.length; i++){
for(int j=0; j<charSet.length; j++){
try{
System.out.println(charSet\[i\]+":"+charSet\[j\] +"="+ new String(str.getBytes(charSet\[i\]), charSet\[j\]));
System.out.println(bytesToHex(str.getBytes(charSet\[i\])));
System.out.println(new String());
}catch(Exception e){
e.printStackTrace();
}
}
}
} }