반응형

-------------------------------------------------------------
질문
-------------------------------------------------------------
다음은 저의 허접 소스의 일부입니다.  
한글이 깨져서 나오는데, 이를 해결할 수 있는 방법이 있나요??  
================================================
try
{

sNewFileName = rd.sSaveDir + rd.vFileName.elementAt(FileNum).toString() + "N";
OutputStream os = new FileOutputStream(sNewFileName);
DataOutputStream out = new DataOutputStream(os);

for(int i=0; i < rd.vDB.size(); i++)
{
out.writeBytes("INSERT INTO =TMT003 VALUES(\"");
out.writeBytes(rd.vDB.elementAt(i).toString());
out.writeBytes("\", \"");
out.writeBytes(rd.vTable.elementAt(i).toString());
out.writeBytes("\");");
out.writeBytes("한글 테스트");
out.writeBytes("\n");
out.writeChars("한글 테스트");
out.writeBytes("\n");
out.writeUTF("한글 테스트");
out.writeBytes("\n");
}
return true;
}



-------------------------------------------------------------
답!!!
-------------------------------------------------------------
맞는 방법인지 틀린 방법인지도 모르겠지만

어쨋든 한글은 되게 하는 방법입니다 --;;

import java.io.*;

public class IOTest {
public static void main(String args[]){
try {  
String sNewFileName = "test.txt";  
OutputStream os = new FileOutputStream(sNewFileName);  
DataOutputStream out = new DataOutputStream(os);  
OutputStreamWriter osw = new OutputStreamWriter( out );
osw.write( "한글 테스트" , 0 , "한글 테스트".length() );  
osw.close();
out.close();
os.close();
} catch ( Exception e ) {
e.printStackTrace();
}
  }
}

반응형

'WEB > CGI' 카테고리의 다른 글

2000 이후 달라진 SMTP (ASP, CDO)  (0) 2010.10.21
csv 파일 서버 저장 JSP  (0) 2010.10.21
JSP 파일 업로드  (0) 2010.10.21
PHP 파일의 확장자 분리하기  (0) 2010.10.21
E-mail programming 관련  (0) 2010.10.20

+ Recent posts