I'm wondering how to get WordPress to display these Unicode place names correctly?

I use Google Maps API JSON data to get the place names and create Woocommerce categories for products. However, for some places, the results look like this:

screenshot of front end

The raw JSON from the API also contains the same characters e.g. \u0130stanbul. I've confirmed u0130 is a Unicode character.

Here's the JSON from Google that was used to create the example:

  "3": {
    "long_name": "Asia",
    "short_name": "Asia",
    "types": ["continent", "political"]
  "2": {
    "long_name": "Turkey",
    "short_name": "TR",
    "types": ["country", "political"]
  "1": {
    "long_name": "\u0130stanbul",
    "short_name": "\u0130stanbul",
    "types": ["administrative_area_level_1", "political"]
  "0": {
    "long_name": "Istanbul",
    "short_name": "Istanbul",
    "types": ["locality", "political"]

Interested to know if anyone has come across this before?

1 Answer 1


I'm not sure whether you are using a plugin, or you are coding it yourself. Either way, you can use server side or client side to decode or encode your content.

PHP offers the utf8_decode(); and utf8_encode(); functions, that can be used to decode or encode your content before sending it to the browser, or after being received by the server.

If you need to do this on the client side, JavaScript also offers the same functions. You could take a look into decodeURIComponent(); function.

  • Thanks Jack. I should have said, i'm using a custom script to read the JSON into Wordpress and create products and categories. I've checked wp_terms and it has entries like 'u0130zmir' so it sounds like I need to decode it before displaying it in the UI?
    – Neil
    Aug 15, 2017 at 11:32
  • You're welcome. If it's on the server then yes. But since I'm not familiar with your plugin or script, I can't provide an accurate answer. However the plugin might be using a filter before outputting the data, which you can use to do the decoding.
    – Johansson
    Aug 15, 2017 at 11:34
  • OK thanks. I'll check this and update the answer :)
    – Neil
    Aug 15, 2017 at 11:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.