How to remove unwanted “extra line breaks” that ap

2019-08-21 04:05发布

问题:

Consider the following:

  • Zip up a folder, upload to server
  • unzip on server using 'unzip archive.zip'
  • Download any PHP file from that folder
  • Extra line breaks appear where unwanted

Any ideas why this happens or how to "undo it"? I have tried to do a "find and replace" but that ends up basically minifying the entire file onto "1 line", which is not wanted either...

Examine the attached image here

回答1:

For the sake of posterity: I found that I was able to use this tactic: https://pixelflips.com/blog/removing-line-breaks-in-dreamweaver

  • Open the Find/Replace box (CMD+F / CTRL+F)
  • In the Find enter: [\r\n]{2,}
  • In the Replace enter: \n
  • Check the box "Use regular expression" and un-check any other boxes.
  • The hit "Replace All"

By using Adobe Dreamweaver, which works...

However, I am not going to make my own answer correct as I still wonder why this happens and want to prevent it if possible.



标签: unzip