Windows记事本不支持换行符'\ n' [英] Windows notepad not supporting newline character '\n'

查看:2661
本文介绍了Windows记事本不支持换行符'\ n'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从我的iPhone应用程序我将数据从文本输出到文件。当使用Windows记事本打开时,数据全部在一行上,并且应该有一个新行,其中存在一个块字符(表明它是一个无法识别的字符或其他东西)。用windows wordpad打开时,显示效果很好。
我的代码会出错吗?当我需要换行时,我只输出'\ n'。

From my iPhone application I'm outputting data from text to a file. When opened with windows notepad, the data is all on one line and where there should be a new line a block character is present (showing that it's an unrecognized character or something). When opened with windows wordpad, it displays just fine.
Would there be something wrong in my code? I'm simply output '\n' when i want a new line.

注意:它可以与其他编辑器一起使用,例如textedit,Mac上的MS Word以及Windows。

NOTE : It's working fine with other editors like textedit, MS Word on mac as well as on windows.

推荐答案

Windows默认使用 \ r \ n 作为行尾标记。记事本只识别,其他文本编辑可能知道其他行端样式并正确呈现。

Windows default is to use \r\n as end-of-line marker. Notepad only recognises that, other text editors may know about other line-end styles and render correctly.

这篇关于Windows记事本不支持换行符'\ n'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆