Changed .escape in JS source to instead be encodeURIComponent to ensure all URI componenets are encoded correctly

- Also removed an empty line in transportheartbeat

#1233