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

213
Visualizações
JS code can't return text with non-latin characters

I've written a simple code that finds the first and last name in the URL and returns them as text and I've been using it as titles for personal pages. Everything works perfectly except if name is written in the non-Latin alphabet (in my case Georgian) it returns seemingly random numbers.

if(window.location.href.includes("authorname")) {
 var strhtp = window.location.href;
 var sbthtp = strhtp .substring(strhtp .indexOf('=') + 1).replaceAll("+", " ");
 document.getElementById("filye").innerHTML = sbthtp;
}
<span id="filye"></span>

if URL includes authorname=John+Doe it returns normally, but if name is written in Georgian, for example authorname=ვაჟა+ფშაველა it returns seemingly random numbers:

%E1%83%90%E1%83%9A%E1%83%94%E1%83%A5%E1%83%A1%E1%83%90%E1%83%9C%E1%83%93%E1%83%A0%E1%83%94 %E1%83%99%E1%83%9D%E1%83%91%E1%83%94%E1%83%A0%E1%83%98%E1%83%AB%E1%83%94

The best outcome would be if the code was able to return non-Latin names normally. But if that isn't possible I'd like it if you'd help me to either (a) change all non-Latin characters to Latin equivalents or (b) code to return Latin names as text, but reject non-Latin names altogether and return nothing.

Thank you

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