0

I have a .html file with some scripts in it. Works fine on localhost but when I copy it on a server (use ftp) it copies with all text in one line, so of course scripts don't work. How can I fix this?

Is windows->linux problem?

zozo
  • 8,230
  • 19
  • 79
  • 134

2 Answers2

1

On Linux, cat -A <file> will display UNIX endlines as $, DOS endlines as ^M, and tab characters as ^I. It can show you exactly which characters are missing.

$ cat -A file.html

<body>^M
Hello, world!^M
</body>^M

You can convert DOS endlines to UNIX with:

$ dos2unix file.html
David Cain
  • 16,484
  • 14
  • 65
  • 75
hungnv
  • 152
  • 8
0

This is probably a CRLF / LF problem (resulting from the different ways operating systems handle newline characters).

See:

Community
  • 1
  • 1
David Cain
  • 16,484
  • 14
  • 65
  • 75
  • I know the difference... how do I fix it? Is not my dream to type everything again on the server. – zozo Jun 22 '12 at 10:01
  • A global search-and-replace is an easy way. Most programs handle the newline characters sensibly already. You may have an entirely different problem, though. I recommend you add more detail to your question. – David Cain Jun 22 '12 at 10:07
  • Nope... that was it. Changed the editor, worked like a charm. – zozo Jun 22 '12 at 10:10