当前位置: 技术问答>java相关
转义字符显示为黑方块?
来源: 互联网 发布时间:2015-08-24
本文导语: 带有转义字符的字符串,生成在txt文件中,可打开看时,ntfr全是黑方块。 怎么回事呢? | 我认为是和本文编辑软件有关。 你用UltraEdit打开就不会有这样的现象。 还有我一般输出都是换行符都是在封装...
带有转义字符的字符串,生成在txt文件中,可打开看时,ntfr全是黑方块。
怎么回事呢?
怎么回事呢?
|
我认为是和本文编辑软件有关。
你用UltraEdit打开就不会有这样的现象。
还有我一般输出都是换行符都是在封装一下:
PrintWriter pw = new PrintWriter(out12);
然后用pw.println()和print方便了很多。因为不同的系统下,换行符是不一样的,windows下是"rn",其他的事'n',而用PrintWriter.println()它会自动判断的。
JDK API如是说:
public void println()
Terminate the current line by writing the line separator string. The line separator string is defined by the system property line.separator, and is not necessarily a single newline character ('n').
你用UltraEdit打开就不会有这样的现象。
还有我一般输出都是换行符都是在封装一下:
PrintWriter pw = new PrintWriter(out12);
然后用pw.println()和print方便了很多。因为不同的系统下,换行符是不一样的,windows下是"rn",其他的事'n',而用PrintWriter.println()它会自动判断的。
JDK API如是说:
public void println()
Terminate the current line by writing the line separator string. The line separator string is defined by the system property line.separator, and is not necessarily a single newline character ('n').
|
在是是这个:
out12.write("0"+"\n");
out12.write("0"+"\n");
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。