[問題] io字元編碼簡轉繁?
請問一下
如果我有一個文件
我想透過io將他簡轉繁
改怎麼做
我自己寫轉不出來 不知道哪裡寫錯??
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
public class NewClass15 {
public static void main(String[] args) throws IOException {
InputStream fin = new FileInputStream(new File("c:\\a.txt"));
// a.txt 裡面是簡體字
FileOutputStream fout = new FileOutputStream(new File("c:\\b.txt"));
byte[] c = new byte[512];
while (fin.available() > 0) {
fin.read(c);
fout.write(new String(c, "BIG5").getBytes("MS950"));
}
fin.close();
fout.close();
}
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 210.243.58.130
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):