# jsonEncode and jsonDecode issue with special characters

**URL:** <https://forum.inductiveautomation.com/t/jsonencode-and-jsondecode-issue-with-special-characters/8109>\
**Category:** Ignition\
**Created:** [March 5, 2014, 9:53pm UTC](https://forum.inductiveautomation.com/t/jsonencode-and-jsondecode-issue-with-special-characters/8109 "2014-03-05T21:53:37Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Javachon](https://avatars.discourse-cdn.com/v4/letter/j/ac8455/32.png) [@Javachon](https://forum.inductiveautomation.com/u/Javachon)\
**Post date:** [March 5, 2014, 9:53pm UTC](https://forum.inductiveautomation.com/t/jsonencode-and-jsondecode-issue-with-special-characters/8109/1 "2014-03-05T21:53:37Z")

</div>

Hi, is there a limitation on the supported characters for json encoding ? When running this code

```auto
tagsArray = []
tagsArray.append(["bébé"])
TagsAsJSON = system.util.jsonEncode(tagsArray)
tagsArray = system.util.jsonDecode(TagsAsJSON)
tagsDS = system.dataset.toDataSet(["Test"],tagsArray)

print tagsDS.getValueAt(0,0)
```

I get “bÃƒÂ©bÃƒÂ©” instead of “bébé”

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [March 5, 2014, 10:13pm UTC](https://forum.inductiveautomation.com/t/jsonencode-and-jsondecode-issue-with-special-characters/8109/2 "2014-03-05T22:13:49Z")

</div>

No. This is probably a character encoding issue. Try using a Python Unicode string instead of a byte string:

Use this:

```auto
tagsArray.append([u"bébé"])
```

Instead of this:

```auto
tagsArray.append(["bébé"])
```

---

<div class="post-metadata">

**Author:** ![Javachon](https://avatars.discourse-cdn.com/v4/letter/j/ac8455/32.png) [@Javachon](https://forum.inductiveautomation.com/u/Javachon)\
**Post date:** [March 17, 2014, 3:52pm UTC](https://forum.inductiveautomation.com/t/jsonencode-and-jsondecode-issue-with-special-characters/8109/3 "2014-03-17T15:52:42Z")

</div>

Using

```auto
tagsArray.append([u"bébé"])
```

I get “bÃ©bÃ©” instead of “bébé”

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [March 17, 2014, 3:58pm UTC](https://forum.inductiveautomation.com/t/jsonencode-and-jsondecode-issue-with-special-characters/8109/4 "2014-03-17T15:58:54Z")

</div>

Okay, what version of Ignition are you using? Are you using Windows or Linux?

---

<div class="post-metadata">

**Author:** ![Javachon](https://avatars.discourse-cdn.com/v4/letter/j/ac8455/32.png) [@Javachon](https://forum.inductiveautomation.com/u/Javachon)\
**Post date:** [March 17, 2014, 5:49pm UTC](https://forum.inductiveautomation.com/t/jsonencode-and-jsondecode-issue-with-special-characters/8109/5 "2014-03-17T17:49:47Z")

</div>

I use 7.6.4 (b2013112117) on Windows

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [March 17, 2014, 11:04pm UTC](https://forum.inductiveautomation.com/t/jsonencode-and-jsondecode-issue-with-special-characters/8109/6 "2014-03-17T23:04:14Z")

</div>

Instead of printing out the result, can you display it in a message box? I have a feeling you’re now running in to a display bug in the Windows console that’s been fixed for 7.6.6.

---

<div class="post-metadata">

**Author:** ![Javachon](https://avatars.discourse-cdn.com/v4/letter/j/ac8455/32.png) [@Javachon](https://forum.inductiveautomation.com/u/Javachon)\
**Post date:** [March 18, 2014, 4:49pm UTC](https://forum.inductiveautomation.com/t/jsonencode-and-jsondecode-issue-with-special-characters/8109/7 "2014-03-18T16:49:56Z")

</div>

Hi,

I get the same string in a messagebox.

Also, I just saw this in the 7.6.5.2014031012-rc4 release notes :

Fixed - The scipting function system.util.jsonEncode now encodes Unicode characters.

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [March 18, 2014, 5:21pm UTC](https://forum.inductiveautomation.com/t/jsonencode-and-jsondecode-issue-with-special-characters/8109/8 "2014-03-18T17:21:23Z")

</div>

Ah, well that would explain it. 🙂

I do apologize for the issues you’ve had with non-English characters. We’ve been working hard on getting all of these tracked down and squashed. AFAIK, 7.6.5 will only have a couple Windows-specific issues (printing to the console and error messages in the GCU), which have been fixed for 7.6.6.
