Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parseQueryString() is using deprecated unescape() #64

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vitorbaptista
Copy link
Contributor

According to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Deprecated_and_obsolete_features

The escape and unescape functions are deprecated. Use encodeURI, encodeURIComponent, decodeURI or decodeURIComponent to encode and decode escape sequences for special characters.

The problem I had with it is was with accented characters:

> str = encodeURIComponent("Yaoundé 6")
"Yaound%C3%A9%206"
> unescape(str)
"Yaoundé 6"
> decodeURIComponent(str)
"Yaoundé 6"

This won't happen if we've used escape(str) instead of encodeURIComponent(), but the encoded string that comes from the window.location, for example, uses the codification as encodeURIComponent().

There's a good comparison about these methods in http://xkr.us/articles/javascript/encode-compare/

@vitorbaptista vitorbaptista self-assigned this Jun 4, 2014
According to
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Deprecated_and_obsolete_features

> The escape and unescape functions are deprecated. Use encodeURI,
> encodeURIComponent, decodeURI or decodeURIComponent to encode and decode
> escape sequences for special characters.

The problem I had with it is was with accented characters:

```
> str = encodeURIComponent("Yaoundé 6")
"Yaound%C3%A9%206"
> unescape(str)
"Yaoundé 6"
> decodeURIComponent(str)
"Yaoundé 6"
```

This won't happen if we've used `escape(str)` instead of
`encodeURIComponent()`, but the encoded string that comes from the
`window.location`, for example, uses the codification as
`encodeURIComponent()`.

There's a good comparison about these methods in
http://xkr.us/articles/javascript/encode-compare/
vitorbaptista added a commit to openspending/cameroon.openspending.org that referenced this pull request Jun 4, 2014
This was needed to get the fix at
openspending-archive/openspendingjs#64 . We're using the
64-deprecated-unescape branch, but should move to master whenever that's
merged.
@vitorbaptista vitorbaptista removed their assignment Dec 2, 2015
@vitorbaptista
Copy link
Contributor Author

@akariv Is this repository still used?

@akariv
Copy link

akariv commented Jul 19, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants