如果你重数据库中取出的数据是乱码的话,可以试着这样转:
String str = 数据库中的数据;
str = new String(str.getBytes("编码类型"), "编码类型");
如果你从数据库中取出的数据是好的,写文件的时候出问题的话,你可以试下这样写:
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("文件数径"), "编码类型"));
String str = 数据库中的数据;
str = new String(str.getBytes("编码类型"), "编码类型");
如果你从数据库中取出的数据是好的,写文件的时候出问题的话,你可以试下这样写:
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("文件数径"), "编码类型"));
从数据库中取出来的是gbk,但是写到aix里就得先转成iso8859-1