Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

230
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda