We were having trouble POSTing emojis correctly on our app using RoboSpice, where each emoji or non-Latin character would render as Ÿ‰ð. We knew this wasn’t a server issue, as the iOS app wasn’t having problems. We were using a separate RestTemplate for this particular request, but it turned out we simply needed to provide charset=utf-8 as part of our Content-Type header:



After, based on this StackOverflow answer:

HttpHeaders headers = new HttpHeaders();
headers.set("Connection", "Close");
Charset utf8 = Charset.forName("UTF-8");
MediaType mediaType = new MediaType("application", "x-www-form-urlencoded", utf8);

There seems to be another way to continue using the APPLICATION_FORM_URLENCODED constant with the MediaType constructor while passing in the charset, but I couldn’t figure it out in 5 minutes from the documentation.

$ logout