Issue with JSON content containing Arabic

Greets :slight_smile:

So I have an app which is being rendered in 2 languages: English + Arabic.

It’s using a WordPress backend with the WP Rest API plugin which will allow the client to add new content to the app. The English part of the app is built and running smoothly.

However I’ve run into an issue when trying to use Arabic. When there’s Arabic in the JSON, I get an error along the lines of

Unexpected token W in JSON at position 0

When I remove the Arabic from the content so that the JSON is arabic free, problem goes away.

I’m assuming this is something to do with the encoding for Arabic etc?

Any thoughts to how I should be doing this to get around the problem?


Can you show us an example of the JSON that causes the problems?

Sure: doesn’t seem to like that JSON either.

Maybe you can’t output Arabic this way in a JSON file?

For anyone else who has this issue, the problem lay with the encoding of the Arabic data in WordPress.

This plugin solved the issue: