# Special Characters

**URL:** <https://forum.inductiveautomation.com/t/special-characters/16375>\
**Category:** Ignition\
**Created:** [December 20, 2017, 2:00pm UTC](https://forum.inductiveautomation.com/t/special-characters/16375 "2017-12-20T14:00:41Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Step7](https://avatars.discourse-cdn.com/v4/letter/s/45deac/32.png) [@Step7](https://forum.inductiveautomation.com/u/Step7)\
**Post date:** [December 20, 2017, 2:00pm UTC](https://forum.inductiveautomation.com/t/special-characters/16375/1 "2017-12-20T14:00:41Z")

</div>

I am having a problem inserting text with special characters into a table using Ignition. For instance, If I try to write words that have an accent or tilde, it converts them to unreadable characters. Here are the conditions:

1. I have a table with a NVARCHAR(MAX) column. I’m using SQL Server 2014.
2. I have some text with Spanish characters (I’ll use “‘cuánto piñata’” for this example).
3. If I write a simple update query from the Management Studio, it works fine, i.e. “UPDATE Faults SET Fault=N’cuánto piñata’”. It also works if I just past the text into the column.
4. If I write the same update query from Ignition, the table updates with “cuÃ¡nto piÃ±ata”

So far I’ve tried both system.db.runUpdateQuery and system.db.runPrepUpdate. If I output my query text to the debug console, it displays correctly, so something is happening to the query via the JDBC driver. I did a test with modifying the collation settings in both the table and column, and that didn’t help, plus I didn’t want to do it that way anyway because it should be able to accept multiple languages.

Any ideas?

(To the Spanish speaking members here, I know my example is probably gibberish. I was just looking for a couple of random words with special characters.)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [December 20, 2017, 2:55pm UTC](https://forum.inductiveautomation.com/t/special-characters/16375/2 "2017-12-20T14:55:02Z")

</div>

You have to make sure the database is set up to use a locale that supports your character set, and that the column data type is set to use it. The most compatible way to do this is to set the database to use UTF-8 everywhere, and make the columns accept that encoding. The gibberish you are seeing is typical of UTF-8 (from Ignition) being incorrectly stored under a single-byte encoding.

---

<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:** [December 20, 2017, 3:24pm UTC](https://forum.inductiveautomation.com/t/special-characters/16375/3 "2017-12-20T15:24:20Z")

</div>

Definitely what Phil said.

For future people who find this thread, for some databases you’ll also need to add to the connection properties. For example, in MySQL you need to add `useUnicode=yes;characterEncoding=utf8;` . For SQL Server, the `sendStringParametersAsUnicode` property [(docs)](https://docs.microsoft.com/en-us/sql/connect/jdbc/setting-the-connection-properties) looks interesting, but I rarely play with SQL Server so I haven’t tested using it.

---

<div class="post-metadata">

**Author:** ![Step7](https://avatars.discourse-cdn.com/v4/letter/s/45deac/32.png) [@Step7](https://forum.inductiveautomation.com/u/Step7)\
**Post date:** [December 20, 2017, 5:55pm UTC](https://forum.inductiveautomation.com/t/special-characters/16375/4 "2017-12-20T17:55:58Z")

</div>

How exactly do I set a column or database to use UTF-8? Does it have anything to do with the collation setting? I don’t see a UTF-8 setting anywhere.

And where do I set the locale for the database?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [December 20, 2017, 6:51pm UTC](https://forum.inductiveautomation.com/t/special-characters/16375/5 "2017-12-20T18:51:44Z")

</div>

> [@Step7](#):
>
> How exactly do I set a column or database to use UTF-8?

It is database-specific, typically set up during database creation with a default for all tables and indices to follow. In PostgreSQL, when I [setup the empty cluster](https://www.postgresql.org/docs/9.5/static/creating-cluster.html), I use --encoding=UTF-8 as an option to the [initdb command](https://www.postgresql.org/docs/9.5/static/app-initdb.html).  
You'll have to find the equivalent for whichever database you are using, and find the documentation for changing these settings after-the-fact.

---

<div class="post-metadata">

**Author:** ![Step7](https://avatars.discourse-cdn.com/v4/letter/s/45deac/32.png) [@Step7](https://forum.inductiveautomation.com/u/Step7)\
**Post date:** [December 20, 2017, 8:07pm UTC](https://forum.inductiveautomation.com/t/special-characters/16375/6 "2017-12-20T20:07:33Z")

</div>

I did some digging, and found this: "SQL Server stores Unicode data (i.e. that which is found in the XML and N-prefixed types) in UCS-2 / UTF-16 (storage is the same, UTF-16 merely handles Supplementary Characters correctly). This is not configurable: there is no option to use either UTF-8 or UTF-32. "

I also tried something else, and stored “piñata” as VARBINARY by first converting in in the INSERT statement, and then converting it back when I attached it to a label, but I had the same results. I didn’t think VARBINARY would care about encoding, but apparently piñata is modified before it gets to the database.

One other odd thing I found: I did a test and intentionally made an error in the UPDATE query so it would throw an error. In the error dialog, “piñata” is garbled, but in the Output Console, it is displayed correctly. So something is happening to it before the query is executed, or so it seems. Also, if I write to the database with the Query editor and read the value back through Ignition, it works fine, so it doesn’t seem to be an encoding issue in the database.

Any other ideas?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [December 20, 2017, 8:18pm UTC](https://forum.inductiveautomation.com/t/special-characters/16375/7 "2017-12-20T20:18:24Z")

</div>

> [@Step7](#):
>
> This is not configurable: there is no option to use either UTF-8 or UTF-32.

Well, I guess you're screwed. You have characters that need a multibyte representation, and your database isn't set up to hold them. Consider changing all of your CHAR and VARCHAR columns to NCHAR and NVARCHAR. Otherwise, you'll have to pick an encoding/locale that covers all the accented characters you need in single bytes. Then you'll have to enforce that in every place in the server that handles these characters, and on every client that can query for them. Good luck.

---

<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:** [December 20, 2017, 9:17pm UTC](https://forum.inductiveautomation.com/t/special-characters/16375/8 "2017-12-20T21:17:37Z")

</div>

Phil, UTF-16 is a two-byte representation. It’s what Java uses internally, so it should be fine. But OP will definitely have to use NVARCHAR instead of VARCHAR.

---

<div class="post-metadata">

**Author:** ![Step7](https://avatars.discourse-cdn.com/v4/letter/s/45deac/32.png) [@Step7](https://forum.inductiveautomation.com/u/Step7)\
**Post date:** [December 21, 2017, 12:15am UTC](https://forum.inductiveautomation.com/t/special-characters/16375/9 "2017-12-21T00:15:22Z")

</div>

I am already using NVARCHAR (see first post), and it handles the special characters fine if the update query doesn’t come from Ignition.

---

<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:** [December 21, 2017, 2:01pm UTC](https://forum.inductiveautomation.com/t/special-characters/16375/10 "2017-12-21T14:01:09Z")

</div>

I’d suggest having support go over your set up with you. We have a lot of end users with non-latin alphabets using Ignition with SQL Server, so this definitely something they know how to do. Unfortunately, I don’t have a SQL Server instance on this machine, so it’s going to be way more efficient to have them help.

---

<div class="post-metadata">

**Author:** ![Sanderd17](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sanderd17/32/8735_2.png) [@Sanderd17](https://forum.inductiveautomation.com/u/Sanderd17)\
**Post date:** [December 22, 2017, 7:37am UTC](https://forum.inductiveautomation.com/t/special-characters/16375/11 "2017-12-22T07:37:43Z")

</div>

à in UTF-8 is encoded as 0xc3a1 (see [http://www.utf8-chartable.de/](http://www.utf8-chartable.de/)). So it looks like somewhere on the way, it is interpreted as an 8-bit ASCII extension like Latin-1 ([https://cs.stanford.edu/people/miles/iso8859.html](https://cs.stanford.edu/people/miles/iso8859.html)): 0x3c and 0xa1, which matches the “Ã¡” string.

While Java and SQL both operate on UTF-16 by default, Python prefers UTF-8 (which fits a newer language that prefers a superior encoding). So the issue is probably inside python.

Could you try to explicitly encode the string to utf-16? `"MyString".encode("utf-16")`

---

<div class="post-metadata">

**Author:** ![Step7](https://avatars.discourse-cdn.com/v4/letter/s/45deac/32.png) [@Step7](https://forum.inductiveautomation.com/u/Step7)\
**Post date:** [December 22, 2017, 12:35pm UTC](https://forum.inductiveautomation.com/t/special-characters/16375/12 "2017-12-22T12:35:44Z")

</div>

When I do that, I get this error: “org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 302; An invalid XML character (Unicode: 0x0) was found in the CDATA section.”

But I think you are on the right track. To get around this temporarily, what I did was use Ignition to create some \*.SQL files on the local drive and I manually executed them from Management Studio, and all the special characters displayed correctly (this is a database of foreign language fault texts for a machine that is installed in various countries). So it definitely looks like Ignition prepares the query correctly, but the encoding breaks when it is passed through the jdbc connection.

---

<div class="post-metadata">

**Author:** ![RohanPalshikar](https://avatars.discourse-cdn.com/v4/letter/r/7ba0ec/32.png) [@RohanPalshikar](https://forum.inductiveautomation.com/u/RohanPalshikar)\
**Post date:** [April 17, 2019, 9:43pm UTC](https://forum.inductiveautomation.com/t/special-characters/16375/13 "2019-04-17T21:43:49Z")

</div>

Hi All,

I have a special character related issue, but not related to database but system.util.httpPost operation.

returnVal = system.net.httpPost(url = serverEndPoint, contentType = “Application/JSON”, postData = jsonString, connectTimeout = ConnTmeOut, readTimeout = ReadTimeOut, username = uname, password = pword, headerValues = {“Authorization”:auth}, bypassCertValidation = 1, throwOnError = 0)

print returnValue

This is expected to print “Grünberg” - which I can see when I call the web service from postman.

but in ignition it prints - ‘GrÃ¼nberg’

I tried doing returnValue.encode(“utf-16”) but that did not help. Any clues!

---

<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:** [April 17, 2019, 10:39pm UTC](https://forum.inductiveautomation.com/t/special-characters/16375/14 "2019-04-17T22:39:37Z")

</div>

You should put this into a new post, since it’s about a completely different part of the software.

---

<div class="post-metadata">

**Author:** ![RohanPalshikar](https://avatars.discourse-cdn.com/v4/letter/r/7ba0ec/32.png) [@RohanPalshikar](https://forum.inductiveautomation.com/u/RohanPalshikar)\
**Post date:** [April 17, 2019, 11:50pm UTC](https://forum.inductiveautomation.com/t/special-characters/16375/15 "2019-04-17T23:50:52Z")

</div>

ok I will post this to a different topic

---

<div class="post-metadata">

**Author:** ![Lahaul\_Seth](https://avatars.discourse-cdn.com/v4/letter/l/3ab097/32.png) [@Lahaul\_Seth](https://forum.inductiveautomation.com/u/Lahaul_Seth)\
**Post date:** [February 26, 2026, 12:57pm UTC](https://forum.inductiveautomation.com/t/special-characters/16375/16 "2026-02-26T12:57:04Z")

</div>

I just came upon this post. I’m facing the same issue for XML data type on SQL Server DB when update query is being run from Ignition. Was there a fix or workaround for this ? I anyways created a new topic for this - [Spanish Characters Encoding issue with Ignition while committing to SQL Server DB](https://forum.inductiveautomation.com/t/spanish-characters-encoding-issue-with-ignition-while-committing-to-sql-server-db/114201)
