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

229
Visualizações
Copied link with encoded space %20 gets encoded second time. How to avoid this?

There is a link eg. http://localhost:4200/test/test%20link, where %20 is encoded space. When I copy this link and try to open in new tab, the %20 will switch to %2025. How to avoid this issue?

openWindow() {
  const link = 'test link';
  window.open(
    `https://window-open-with-angular.stackblitz.io/${link}`,
    'Independent Window',
  this.windowFeatures.join()
);

Case scenario: Somebody sents a link, in which is encoded space. When receiver tries to open the link, it crashes due to unwanted encoding.

Here is an example

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

0

The space character is encoded as %20 and the % character is encoded as %25.

The way you get %2520 is when the url already has a %20 in it get encoded again to produce %2520

If you copy-paste http://localhost:4200/test/test link you would only get %20, as wanted.

If you copy-paste http://localhost:4200/test/test%20link you would get %2520.

Do not encode your link twice when it is already encoded. Send your link with the raw spaces.

about 4 years ago · Juan Pablo Isaza Relatório

0

Answer above does not answer the issue.

What was the issue, which caused double encoding? At the top of the appplication was made routing with Angular Router, which was encoding url while logging user.

How the problem was solved? A method called decodeURIComponent() was used to solve the problem.

router.navigate(urlPath) -> router.navigate(decodeURIComponent(urlPath)

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