# Spanish Characters Encoding issue with Ignition while committing to SQL Server DB

**URL:** <https://forum.inductiveautomation.com/t/spanish-characters-encoding-issue-with-ignition-while-committing-to-sql-server-db/114201>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [February 26, 2026, 11:03am UTC](https://forum.inductiveautomation.com/t/spanish-characters-encoding-issue-with-ignition-while-committing-to-sql-server-db/114201 "2026-02-26T11:03:43Z")\
**Posts on this page:** 10\
**Page:** 1

<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, 11:03am UTC](https://forum.inductiveautomation.com/t/spanish-characters-encoding-issue-with-ignition-while-committing-to-sql-server-db/114201/1 "2026-02-26T11:03:44Z")

</div>

We have some incoming inventory XMLs which has Spanish characters. We store the XML in a SQL Server DB table with XML datatype for the column. XML datatype already supports UTF-8 encoding, so there shouldn’t be any issue with storing Spanish characters.

If I directly use an insert command to store Spanish characters on SQL Server, they remain intact. But when I try to insert the XML using system.db.runUpdateQuery() with N’ ‘ prefix or system.db.runPrepUpdate with ? parameters from a script, the Spanish encoding breaks during storage in DB. Garbled characters get stored.

Has anyone else seen this behavior from Ignition script or know a fix for this ?

I also saw this old post. Not sure whether a similar issue could be there for XML data type on SQL Server DB - [Special Characters](https://forum.inductiveautomation.com/t/special-characters/16375)

---

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [February 26, 2026, 11:28am UTC](https://forum.inductiveautomation.com/t/spanish-characters-encoding-issue-with-ignition-while-committing-to-sql-server-db/114201/2 "2026-02-26T11:28:41Z")

</div>

Maybe make sure you’re passing a real Unicode string from Jython u" befreo store it on the SQL Server

xml\_u = unicode(xml\_string) # or ensure it’s u"..."  
system.db.runPrepUpdate("INSERT ... VALUES (?)", [xml\_u], "CONN")

---

<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, 11:45am UTC](https://forum.inductiveautomation.com/t/spanish-characters-encoding-issue-with-ignition-while-committing-to-sql-server-db/114201/3 "2026-02-26T11:45:53Z")

</div>

Tried this. Didn’t work.

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [February 26, 2026, 3:37pm UTC](https://forum.inductiveautomation.com/t/spanish-characters-encoding-issue-with-ignition-while-committing-to-sql-server-db/114201/4 "2026-02-26T15:37:54Z")

</div>

> [@Alejandro\_Alaco](#):
>
> Maybe make sure you’re passing a real Unicode string from Jython u" befreo store it on the SQL Server
> 
> xml\_u = unicode(xml\_string) # or ensure it’s u"..."  
> system.db.runPrepUpdate("INSERT ... VALUES (?)", [xml\_u], "CONN")

I wonder if you need to also add the "u" in front of the SQL query like so:

```python
xml_u = unicode(xml_string) # or ensure it’s u"..."
system.db.runPrepUpdate(u"INSERT ... VALUES (?)", [xml_u], "CONN")

```

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [February 26, 2026, 4:07pm UTC](https://forum.inductiveautomation.com/t/spanish-characters-encoding-issue-with-ignition-while-committing-to-sql-server-db/114201/5 "2026-02-26T16:07:41Z")

</div>

Have you tried via a named query?

---

<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:** [February 26, 2026, 4:12pm UTC](https://forum.inductiveautomation.com/t/spanish-characters-encoding-issue-with-ignition-while-committing-to-sql-server-db/114201/6 "2026-02-26T16:12:05Z")

</div>

At the point where you **get** the XML from the external source, log `repr(xml)` to see if the encoding is broken before you ever try to put it in the DB.

---

<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 27, 2026, 4:43am UTC](https://forum.inductiveautomation.com/t/spanish-characters-encoding-issue-with-ignition-while-committing-to-sql-server-db/114201/7 "2026-02-27T04:43:18Z")

</div>

@michael.flagler - Tried your recommendation. Didn’t work.

---

<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 27, 2026, 10:44am UTC](https://forum.inductiveautomation.com/t/spanish-characters-encoding-issue-with-ignition-while-committing-to-sql-server-db/114201/8 "2026-02-27T10:44:15Z")

</div>

Thanks for this tip. Encoding was breaking when XML was being retrieved from an url. I used the following code to fix it along with system.db.runPrepUpdate()

```python
client = system.net.httpClient()
response = client.get(url)
filecontent = response.getText("UTF-8")

```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [February 27, 2026, 5:27pm UTC](https://forum.inductiveautomation.com/t/spanish-characters-encoding-issue-with-ignition-while-committing-to-sql-server-db/114201/9 "2026-02-27T17:27:59Z")

</div>

Interesting. `getText` uses the charset returned in the response headers, falling back to UTF-8 automatically if not specified. You had to add the explicit charset to get it to work, or you had to migrate to `system.net.httpClient` vs `system.net.httpGet` or something?

---

<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:** [March 2, 2026, 8:33am UTC](https://forum.inductiveautomation.com/t/spanish-characters-encoding-issue-with-ignition-while-committing-to-sql-server-db/114201/10 "2026-03-02T08:33:17Z")

</div>

I was using system.net.httpGet initially.

I switched to system.net.httpClient and set UTF-8 explicitly as all the XMLs we receive are in UTF-8 format.
