Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

207
Visualizações
How to check if the special character I'm seeing is indeed what I'm seeing or it's just an HTML entity in disguise?

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 &#8217;, 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 &#8217; 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?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda