现在我有一个文件夹js,js下面有很多各种名字的文件夹,每个文件夹下面只有一个code.html文件和几个图片,我现在想把所有js目录下的html文件读出来,写在一个txt文件里,没个html文件之间用
**************************************
某某文件开始
**************************************
和
*************************************
某某文件结束
*************************************
来区分,
可是不论我用reader和writer还是inputStream和OutputStream,写出来的都是乱码。这是为什么啊?求解释。我到底要怎么做啊?还有诸如制表符和换号符对应的字节码是多少啊?
**************************************
某某文件开始
**************************************
和
*************************************
某某文件结束
*************************************
来区分,
可是不论我用reader和writer还是inputStream和OutputStream,写出来的都是乱码。这是为什么啊?求解释。我到底要怎么做啊?还有诸如制表符和换号符对应的字节码是多少啊?
可以转换一下编码
假如文件编码是UTF-8的,则
str = new String(str.getByte("GBK"),"UTF-8");
-----------平滑图片滚动code1.htm--start------------------
********************************************
[B@e61fd1
[B@1267649
[B@107f45d
[B@b40ec4
[B@458f41
[B@bb494b
[B@2f729e
[B@10deb5f
[B@d7b7d9
[B@671f95
[B@4a9a7d
[B@1e4a47e
[B@1eb5666
[B@1754699
[B@6e1dec
[B@16ea269
[B@68cb6b
[B@18e4327
while( (Information =in.readLine())!=null){
out.write(Information);
out.newLine();
}
这是改之后的代码:
while( (Information =in.readLine())!=null){
Information =Information.getBytes("gb2312").toString();
out.write(Information);
out.newLine();
}
out = BUfferWriter(new BufferWrite("path");
改之前时乱码,改了以后就变3楼这个了这个了,求解释。到底要怎么改啊?
out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file_Location+"js页面编写.txt"),"gb2312")); in = new BufferedReader( new InputStreamReader(new FileInputStream(fileD1_Location+"\\"+ss+"\\"+s),"gb2312"));?< ! D O C T Y P E h t m l P U B L I C " - / / W 3 C / / D T D X H T M L 1 . 0 T r a n s i t i o n a l / / E N " " h t t p : / / w w w . w 3 . o r g / T R / x h t m l 1 / D T D / x h t m l 1 - t r a n s i t i o n a l . d t d " >