Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

文件读取问题 #56

Closed
jerryxht opened this issue Apr 10, 2015 · 7 comments
Closed

文件读取问题 #56

jerryxht opened this issue Apr 10, 2015 · 7 comments

Comments

@jerryxht
Copy link

fs.readFile 有时候只能读取出部分内容,可能因为文件里有个别奇怪的字符的问题,但是不管遇到什么字符都应该能读取完整的文件内容
我有测试文件,但是我怎么上传呢

@dayuoba
Copy link

dayuoba commented Apr 11, 2015

应该不是奇怪的字符的问题,文件读取的时候走的是Buffer
把你的测试代码贴到这里看看呢

@jerryxht
Copy link
Author

var fs=require("fs");
var text=fs.readFile("addr.txt");
console.log(text);
代码很简单,就这样,打印出来只有一半,但难道问题出在打印上了

@dayuoba
Copy link

dayuoba commented Apr 11, 2015

@jerryxht 有可能啊,设置一下encoding看看呢

@jerryxht
Copy link
Author

已经可以确认是console.log的问题,部分字符打印不出来,然后问题字符的后边的字符都打印不出来了

科 

8

科与8中间有一个空白字符和换行,打印到那个空白字符就会出问题

总的来说问题不是太致命,但还是希望能修正,不然调试的时候不好定位问题

@jerryxht
Copy link
Author

我弄到啥了,字体咋变大了

@yjhjstz
Copy link

yjhjstz commented Jun 20, 2015

二进制看看有没有结束符‘\0’ ? @jerryxht

@LuoZijun
Copy link

LuoZijun commented Jul 1, 2015

@jerryxht 应该是你 在文字开头 使用了 markdown 的 标题 符号 # 或者 使用了 HTML 标签 <h1>

@fibjs fibjs closed this as completed Aug 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants