Can Cypher interpret HTML character codes as input?

Occasionally I need to use HTML character codes as a part of the query string, like &#8217 for ', and ] for ]. I know that there is a way to convert them back to the proper characters to be able to use Cypher, but is there a way to make Cypher automatically decode them?That would be neater.

So for example if my query is

match (n)-[r]-(m) where n.gid=’Cx’ and m.gid=’Cx’ return n,r,m

it will understand as

match (n)-[r]-(m) where n.gid='Cx' and m.gid='Cx' return n,r,m

There are a couple of different ways of doing this, but I would check out apoc.text.urldecode here

However -- the code that you've got here suggests that the cypher query itself is being submitted as a URL encoded string, and that you are interpolating that URL encoded data as part of an actual cypher query. If this is the case, please reconsider your approach because it would likely make your application vulnerable to a security problem called cypher query injection. You can read more about that here

Thanks for the info. However, this is a HTML entity, not percent-encoding that is used for URL. My input is in a div, i.e.

<div id="foo" data-function="bar">match (n)-[r]-() where n.gid='Cx' return n,r</div>

and the ' character is being converted before putting it into a string.