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

210
Visualizações
How to properly unescape non-ASCII cahracters in location.pathname

I have the following URL in the browser address bar:

example.com/search/city/Germany:Baden-Württemberg

From the console I try to get the pathname of the URL:

location.pathname which returns:

/search/city/Germany:Baden-W%C3%BCrttemberg

I see that the ü character has been transformed (escaped) to %C3%BC sequence. I want to dysplay this character as is in the HTML document, therefore I tryed with unescapeing it:

unescape(location.pathname) but unfortunatelly what I get is not the string from the URL > '/search/city/Germany:Baden-Württemberg'

How can I get the URL character ü (from my URL example.com/search/city/Germany:Baden-Württemberg ) via Javascript ?

Thank you!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The solution pointed out by @Cid

Use decodeURI()

worked better in this case than unescape which seems not to be the preferred function for such translations.

From developer.mozilla.org

Usually, decodeURI or decodeURIComponent are preferred over unescape.

Again, all the credits of this answer go to @Cid for his comments on the original questions.

about 4 years ago · Juan Pablo Isaza Relatório
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