重複の可能性:
ファイルから特殊記号を読み取る
ファイルを別のファイルにコピーしようとしています。ファイルはエンコーディング標準 UTF8 を使用しており、ファイルには特殊文字も含まれています。プログラムは、同じ形式の別のファイルに特殊文字をコピーすることができません。ファイルは、特殊記号のボックス形状で乱れています。
try
{
BufferedReader br= new BufferedReader(new InputStreamReader(new FileInputStream(new File("path of the file")),"UTF8") ;
BufferedWriter bw= new BufferedWriter(new OutputStreamReader(new FileOutputStream(new File("path of the output file");
while(br.readLine()!=null)
{
//code here to read and write from a file to another.
}
}
catch(Exception ex
{
ex.printStackTrace();
}