Languages
[Edit]
EN

TypeScript - encode / escape URL characters

3 points
Created by:
Mariam-Barron
811

In this short article, we would like to show how in TypeScript, use encodeURIComponent() function to escape all unsafe characters in some URL.

Quick solution:

or:

 

encodeURIComponent() function converts/escapes characters in the following way:

Not escaped characters

Digits, small and big English letters:
0-9 a-z A-Z

Some special characters:
~ ! * - _ . ' ( )
Escaped characters

Non-English alphabets.
e.g. 日本 Россия ąćęłńóśźż etc.

Reserved symbols in URL / URI:
@ : / ? # & =

Unicode characters like emoji, icons, symbols, etc.
e.g. 🚀 🍏 🍌 ❤️ 💻 🙂

  \t \n - spaces, tabulators, newlines, etc.
Characters that are not counted in the Not escaped characters column.

Practical examples:

 

See alse

Edit
  1. JavaScript - encode / escape URL characters 
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join