openspending/openspendingjs — pull request #64 by vitorbaptista (2014-06-04 13:24:07+00:00)
Title: parseQueryString() is using deprecated unescape()

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/