File file=new File("C:\\Users\\zhili\\Desktop\\产品添加录入表1.csv");
String myCharset = System.getProperty("file.encoding");
System.out.println(myCharset );
InputStreamReader isr=new InputStreamReader(new FileInputStream(file),"GBK");
CsvReader r = new CsvReader(isr);
r.readHeaders();
if(r.readRecord()) {
System.out.println(r.getRawRecord());
}
r.close();
7 个解决方案
#1
GBK換别的编码试试看
#2
ISO-8859-1,utf-8,utf-16,gb2312都试过了
#3
csv文件默认编码为ANSI,这里出现乱码主要是编码不一致问题
DataInputStream in = new DataInputStream(new FileInputStream(new File("d:\\*.csv")));
BufferedReader br= new BufferedReader(new InputStreamReader(in,"GBK"));//这里如果csv文件编码格式是utf-8,改成utf-8即可
DataInputStream in = new DataInputStream(new FileInputStream(new File("d:\\*.csv")));
BufferedReader br= new BufferedReader(new InputStreamReader(in,"GBK"));//这里如果csv文件编码格式是utf-8,改成utf-8即可
#4
楼主乱码问题解决了吗?
#5
将读取出来的字符串再转置下
#6
楼主如何解决的 ,求分享下
#7
把csv文件有UE打开后,另存为。。。一下
#1
GBK換别的编码试试看
#2
ISO-8859-1,utf-8,utf-16,gb2312都试过了
#3
csv文件默认编码为ANSI,这里出现乱码主要是编码不一致问题
DataInputStream in = new DataInputStream(new FileInputStream(new File("d:\\*.csv")));
BufferedReader br= new BufferedReader(new InputStreamReader(in,"GBK"));//这里如果csv文件编码格式是utf-8,改成utf-8即可
DataInputStream in = new DataInputStream(new FileInputStream(new File("d:\\*.csv")));
BufferedReader br= new BufferedReader(new InputStreamReader(in,"GBK"));//这里如果csv文件编码格式是utf-8,改成utf-8即可
#4
楼主乱码问题解决了吗?
#5
将读取出来的字符串再转置下
#6
楼主如何解决的 ,求分享下
#7
把csv文件有UE打开后,另存为。。。一下