Troubleshooting HTTP API Character Encoding
Details on how to resolve issues with character encoding with HTTP API, including programming language function recommendations
When building applications using the HTTP API, it is important to account for any symbols that might interfere with the API string in some way. As a result, it is best practice to triple encode all API strings before calling the API.
Strings that contain symbols such as plus [+] symbol and ampersands [&], and any Unicode characters, must be triple URL encoded and submitted in their encoded form. This ensures such characters a properly escaped.
Many programming languages have functions available for URL encoding.
For example:
ASP.NET (C#)
Using System.Web.HttpUtility;
HttpUtility.UrlEncode(HttpUtility.UrlEncode(HttpUtility.UrlEncode("string")));
Java
import java.net.URLEncoder;
URLEncoder.encode(URLEncoder.encode(URLEncoder.encode("string", "UTF-8"), "UTF-8"), "UTF-8");
PHP
urlencode(urlencode(urlencode($text)));
Running this function three times on any strings you submit will help prevent errors that non-escaped symbols might produce and ensure that Unicode encoded messages are received correctly.