带0D 0D 0A换行符的文本文件 [英] Text file with 0D 0D 0A line breaks

查看:308
本文介绍了带0D 0D 0A换行符的文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

客户向我发送一个.csv文件,其中换行符由 0xD 0xD 0xA 序列组成。据我所知,换行符是来自Mac或Unix的 0xA 或来自Windows的 0xD 0xA

A customer is sending me a .csv file where the line breaks are made up of the sequence 0xD 0xD 0xA. As far as I know line breaks are either 0xA from Mac or Unix or 0xD 0xA from Windows.

是否 0xD 0xD 0xA 任何已知的编码?有没有任何已知的储蓄顺序,损坏文件的行结束导致这(我认为客户使用Mac)?

Is the 0xD 0xD 0xA any known encoding? Is there any known sequence of savings that corrupts a file's line endings that causes this (I think the customer uses a Mac)?

文件不以任何编码开始标记,它直接从文本内容开始。

The file doesn't start with any encoding markers, it starts with the text contents directly. The text is displayed correctly if opened with code page 1252.

推荐答案

CRCRLF被称为 Windows XP记事本文字换行错误

The CRCRLF is known as result of a Windows XP notepad word wrap bug.

以后参考,这里是从链接的博客的相关性摘录:

For future reference, here's an extract of relevance from the linked blog:


当在Windows计算机上按Enter键时,实际存储两个字符:a回车(CR)和换行(LF)。操作系统总是以与Enter键相同的方式解释字符序列CR LF:它移动到下一行。但是,如果自己有额外的CR或LF字符,这有时会导致问题。

When you press the Enter key on Windows computers, two characters are actually stored: a carriage return (CR) and a line feed (LF). The operating system always interprets the character sequence CR LF the same way as the Enter key: it moves to the next line. However when there are extra CR or LF characters on their own, this can sometimes cause problems.

在Windows XP版本的记事本中有一个错误,可能导致额外的CR字符存储在显示窗口中。在以下情况下会发生错误:

There is a bug in the Windows XP version of Notepad that can cause extra CR characters to be stored in the display window. The bug happens in the following situation:

如果您打开了换行选项,并且显示窗口包含卷绕的长行,那么保存文件会导致记事本

If you have the word wrap option turned on and the display window contains long lines that wrap around, then saving the file causes Notepad to insert the characters CR CR LF at each wrap point in the display window, but not in the saved file.

CR CR LF字符在复制和粘贴时可能会导致异常他们进入其他程序。

The CR CR LF characters can cause oddities if you copy and paste them into other programs. They also prevent Notepad from properly re-wrapping the lines if you resize the Notepad window.

您可以通过关闭自动换行功能来​​删除CR CR LF字符,然后单击如果需要,请重新打开。但是,当您这样做时,光标会重新定位在显示窗口的开头。

You can remove the CR CR LF characters by turning off the word wrap feature, then turning it back on if desired. However, the cursor is repositioned at the beginning of the display window when you do this.

这篇关于带0D 0D 0A换行符的文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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