Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2005
    Location
    Ontario, Canada
    Posts
    1,750

    Angry decodeURIComponent fails when passed in %E9

    I just noticed that if I pass %E9 (that is the é character), the function throws an exception and JavaScript says the string is malformed.

    Does anyone know how to fix this problem so that the string decodes correctly. I'm guessing that there are other accented characters that will also cause the same problem?
    C++, 3D OpenGL and Game Programming video tutorials:
    www.MarekKnows.com
    Play my free games: Ghost Toast, Zing, Jewel Thief

  2. #2
    Join Date
    Jan 2011
    Posts
    6
    encodeURIComponent('é') = '%C3%A9', decodeURIComponent('%C3%A9') = 'é'

    escape('é') = '%E9', unescape('%E9') = 'é'

    I'm not sure why this is the case, but I'm fairly certain escape/unescape are considered bad practice nowadays.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •