Accents in URL, how can I escape them correctly ?

10,178

use encodeURIComponent and decodeURIComponent. escape and unescape will be useful only for ASCII charset, while the former supports unicode charsets.

Share:
10,178
Sam
Author by

Sam

Updated on June 27, 2022

Comments

  • Sam
    Sam almost 2 years

    I have to get what is next to the # character in the URL (in javascript). When there's an é, for example, I get escaped characters. I can unescape() them, but I get weird characters such as Ã. How can I get the right characters ?

  • mu is too short
    mu is too short almost 13 years
    Mozilla's MDN is much better JavaScript reference than w3schools.
  • Rodrigo
    Rodrigo almost 13 years
    Lol'd! I use w3schools for references links while posting solutions here in SO.