Home > front end >  Find or create a file that uses MacOS Classic Line endings for a test
Find or create a file that uses MacOS Classic Line endings for a test

Time:10-17

Old versions of Mac used CR (\r) line endings before MacOSX came about. We have some legacy PHP code that supports such files, but that support is being removed in PHP 8. So we want to remove the code that adds this support.

First we want to log where these files are uploaded to see if any user is still using this old format for any reason.

What I'm struggling with is finding or creating a sample file to test the trigger for this log. Is there a way to convert a file to this old format of line endings (even manually) so we have test file to confirm our logging logic?

CodePudding user response:

Maybe this helps to modify a file you have (do not replace with space but with the \CR): How can I replace each newline (\n) with a space using sed?

  • Related