I have a div containing a string which is a Cypher query:
<div id="foo">match (n)-[r]-() where n.gid='Cx' return n,r</div>
Since the '
character will be encoded as ’
, and since Cypher query isn't able to automatically decode it, I need to make sure whether the '
character I see (and Cypher sees as well) is really the '
character, not just ’
but the browser automatically transforms it to '
.
In all the places the character is always showed as '
; the only place it's really show its true evil is in the HTML view-source page. I try using a solution from What's the right way to decode a string that has special HTML entities in it?:
function decodeHtml(html) {
var txt = document.createElement("textarea");
txt.innerHTML = html;
return txt.value;
}
But Cypher still doesn't accept it. But I guess I cannot check when the string is still encoded or not, because anywhere I go, the browser will always show the decoded version.
Another problem is when I add this into the console:
string = document.getElementById('foo').innerText
string.includes("'") //false
string.includes("&") //false
If it return false in both case, then what exactly the version of the character in there? Is it the decoded or encoded version?
Related: Can Cypher interpret HTML character codes as input?