问题描述
如题,我指定了编码集为Unicode下载的csv文件,想上传这个csv文件。请问如何上传才不乱码。inttotalbytes=req.getContentLength();byte[]b=newbyte[totalbytes];StringcontentType=req.getContentType();Stringboundary="";Stringlastboundary="";intpos=contentType.indexOf("boundary=");if(pos!=-1){pos+="boundary=".length();boundary="--"+contentType.substring(pos);lastboundary=boundary+"--";}intstate=NONE;DataInputStreamin=newDataInputStream(req.getInputStream());in.read(b);in.close();Stringreqcontent="";reqcontent=newString(b,unicode);BufferedReaderreqbuf=newBufferedReader(newStringReader(reqcontent));
时间: 2024-12-20 21:39:30