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?
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
This is probably a CRLF / LF problem (resulting from the different ways operating systems handle newline characters).
See: