I have an ejs file in my sails application that looks like this
<a href='/<%= viewname %>?where={"name":"<%= profile.pname %>"}'>
This works for most of the names with the exception of one that has an apostrophe in it. Essentially EJS parses the apostrophe as a sing quote which closes the href and makes the name I'm passing incorrect
http://localhost:1337/myviewnamwe?where={"name":"tom
where it should be
http://localhost:1337/myviewnamwe?where={"name":"tom's diner}
I would use URL encoding for the critical part: {"name":"<%= profile.pname %>"}
More info:
http://www.ruby-doc.org/stdlib-1.9.3/libdoc/uri/rdoc/URI/Escape.html http://www.w3schools.com/tags/ref_urlencode.asp