Page 1 of 1

Line endings and Javascript problems

Posted: Sat 28 Feb 2009 15:58
by David Gibson
Here's another weird problem I have had, trying to get the BCRA web pages to run on the new server...

One particular page threw up the annoyingly vague JavaScript "syntax error" when I tried to run it on BCA's new server. It was fine on the old server, and on localhost.

I eventually realised that - for what reason I do not know - it had been created with MAC-style line endings (i.e. hex 0D). when I converted these to PC-style (0D0A) it ran without error. (Perhaps Unix-style line endings of 0A would also have worked? - let's just see: yes they do work).

The syntax error was caused because JavaScript was expecting to see a line ending, and didnt.

Im assuming - guessing - that the old server I was running the BCRA site on ws either Windows-based or had some property set somewhere to map line endings.

Re: Line endings and Javascript problems

Posted: Wed 08 Apr 2009 12:05
by David Gibson
David Gibson wrote:when I converted these to PC-style (0D0A) it ran without error.
reminder to myself: use WildEdit. Search for regexp \r([^\n]) and replace with \r\n$1 in files *.html