다른 언어로 서버에 로그온하면 "عاتبوها. txt"라고 표시되지만 "????? .txt ". 이제 로그 생성하는 로그 파일에 서버와 데이터를 확인하는 파일도 괜찮서버에 파일 (로그)을 다른 언어로 작성하려고합니다. english_name.txt는 "عاتبوها. txt"가 서버에 "?????. txt"를 표시합니다.
BufferedWriter bw = null;
FileWriter fw = null;
String label = "label test";
// this content comming dynamic value from another method.
String content = "هذا هو اختبار عينة يرجى اختبار";
// this content comming dynamic value from another method.
String room = "اختبار";
Date date = new Date();
try {
String dt = sdf.format(date);
//String convertedRoom = new String(room.getBytes("UTF-8"));
String fileName = room.concat("_").concat(dt).concat(".txt");
File f = new File(fileName);
if(!f.exists()) {
f.createNewFile();
f.setWritable(true);
}
fw = new FileWriter(fileName,true);
bw = new BufferedWriter(fw);
bw.write(content);
bw.flush();
} catch (IOException e) {
//e.printStackTrace();
} finally {
try {
if (bw != null)
bw.close();
if (fw != null)
fw.close();
} catch (IOException ex) {
//ex.printStackTrace();
}
}
...하지만 문제는에서 생성되지 않는 파일 이름입니다 :
코드는 다음과 단절에 로그 파일을 작성하는 arebic.txt와 같은 또 다른 언어, 그 표시 ???????????. _. txt ... 도와주세요.
''string convertedRoom = new String (room.getBytes ("UTF-8"));'무엇을 생각하십니까? 이를 제거하면 불필요하고 잠재적으로 유해 할 수 있습니다. – Kayaman
utf-8을 사용하여 테레비 전어로 사용하십시오. –
그건 완전히 잘못되었습니다. 그것을 꺼내. 그런 생각을 어떻게 내놓았습니까? 작동하지 않습니다. – Kayaman