URL Escaping
When using the Mapfluence API via Javascript, your URLs will be generated in proper escaped format. However, if you code directly to the web services using URLs, you need to worry about proper escaping.
This means means conforming to the W3C specification for URLs, which means percent-encoding for reserved characters. While "|" is not a reserved character, "=" and "+" are reserved characters. Here are some character encodings you might use:
| character | encoding | notes |
|---|---|---|
| = | %3D | outside of query string, i.e. in VisualQuery URLs |
| + | %2B | |
| ' | %27 | |
| ( | %28 | |
| ) | %29 | |
| SPACE | %20 | |
| : | %3A | |
| ; | %3B | not used by VisualQuery URLs |
While mainstream browsers (e.g. Firefox, Safari, Internet Explorer) are usually tolerant enough to understand some of these characters when unencoded and do what you want, there is no guarantee that one of your customers is using some fringe browser, that that browser might not understand the characters if they are not encoded. Similarly, if you or they are using a script with curl or wget, you or they might not get the right results if the characters aren't encoded.
Percent-encoding is so commonly needed -- and so tricky to get absolutely right -- that pretty much every programming language has a standard utility library (or built-in class or function) for doing it:
| language | function |
|---|---|
| PHP | rawurlencode(url) |
| Perl | URI::Escape uri_escape(url) |
| Python | urllib urlencode(url) |
| Javascript | escape(url) |
| VBScript | Server.URLEncode(url) |
| Java | URI(url).toASCIIString() |
If you or your end-users are getting strange errors on a non-standard HTTP client, please check that your characters are properly escaped before you contact us.