admin管理员组文章数量:1305584
I have a Node JS server querying MongoDB, and then render the returns to an EJS template:
res.render('graphFabric.ejs', {'iBeacons':[(beacon)]});
.
When I try to recover the JSON from my template using
<%=iBeacons%>
, '
(single quotes) appear as '
;
For example: udid: 'b9407f30f5f8466eaff925556b57fe6d',
How is it possible to fix this issue since it breaks my JSON structure?
I have a Node JS server querying MongoDB, and then render the returns to an EJS template:
res.render('graphFabric.ejs', {'iBeacons':[(beacon)]});
.
When I try to recover the JSON from my template using
<%=iBeacons%>
, '
(single quotes) appear as '
;
For example: udid: 'b9407f30f5f8466eaff925556b57fe6d',
How is it possible to fix this issue since it breaks my JSON structure?
1 Answer
Reset to default 10Figured from https://github./tj/ejs/tree/0.8.3#features that I was using:
Escapes html by default with <%= code %>
when I should have used Unescaped buffering with <%- code %>
**Replacing =
with -
fixed the problem
本文标签: javascriptEJS doesn39t escape charactersStack Overflow
版权声明:本文标题:javascript - EJS doesn't escape characters - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741806937a2398558.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论