Search code examples
mysqlcarriage-returnlatin1

Line Feeds and Carriage Rerturns in Data: 0D 0A


I am writing a data clean up script (MS Smart Quotes, etc.) that will operate on mySQL tables encoded in Latin1. While scanning the data I noticed a ton of 0D 0A where the line breaks are.

Since I am cleaning the data, should I also address all of the 0D, too, by removing them? Is there ever a good reason to keep 0D (carriage return) anymore?

Thanks!


Solution

  • 0D0A (\r\n), and 0A (\n) are line terminators; \r\n is mostly used in OS Windows, \n in unix systems.

    Is there ever a good reason to keep 0D anymore?

    I think you should answer this question yourself. You could remove '\r' from the data, but make sure that the programs that will use this data understand that '\n' means the end of line very well. In most cases it is taken into account, but check just in case.