1

I have a SpringBoot application. On one of the POST endpoints, in the body I want a field that can contain emoji.

In my request object I have the following field:

private final String name;

In the body of my request I have the following input:

"name" : "Hello, playground \Ud83d\Ude0a \Ud83e\Udd21\Ud83d\Udc68\U200d\Ud83c\Udf73 \U2663\Ufe0f"

which contains some emojis.

The exception I get is:

com.fasterxml.jackson.databind.JsonMappingException: Unrecognized character escape 'U' (code 85)

and

Caused by: com.fasterxml.jackson.core.JsonParseException: Unrecognized character escape 'U' (code 85)

I tried to set the following flag on my object mapper with no luck:

.configure(JsonParser.Feature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER, true)

Any ideas?

Panos
  • 7,227
  • 13
  • 60
  • 95
  • Maybe escape non-ascii like in https://stackoverflow.com/a/23129089/9705485 ? – Ryan Dawson Aug 09 '18 at 12:26
  • @RyanDawson it didn't work :( :( Still throws the same error. I'm pretty sure there should be a way for SpringBoot to support unicode characters... – Panos Aug 09 '18 at 13:55
  • More specifically jackson. Depending on how it's being formed it might need double-backslash https://stackoverflow.com/questions/30187530/java-jackson-parsing-error-unrecognized-character-escape – Ryan Dawson Aug 09 '18 at 14:00
  • I think I found it... The mobile client was sending `\Ude0a` , while jackson needs the U to be lowercase :p :p – Panos Aug 09 '18 at 16:02

0 Answers0