# Table translation map can't parse non-ASCII

**URL:** <https://forum.inductiveautomation.com/t/table-translation-map-cant-parse-non-ascii/3489>\
**Category:** Ignition\
**Created:** [October 25, 2011, 6:39pm UTC](https://forum.inductiveautomation.com/t/table-translation-map-cant-parse-non-ascii/3489 "2011-10-25T18:39:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Greg.Buehler](https://avatars.discourse-cdn.com/v4/letter/g/ecc23a/32.png) [@Greg.Buehler](https://forum.inductiveautomation.com/u/Greg.Buehler)\
**Post date:** [October 25, 2011, 6:39pm UTC](https://forum.inductiveautomation.com/t/table-translation-map-cant-parse-non-ascii/3489/1 "2011-10-25T18:39:29Z")

</div>

There is a problem when using non ASCII characters in the translationMap, no errors are shown, the translation mapping just doesn’t work.

I found I can work around the problem by limiting the translationMap to only contain the first 128 characters in the codepage.

```auto
import system

#print "property: " + event.propertyName
if event.propertyName == "customerLookup":
  data = system.dataset.toPyDataSet(event.newValue)
  kvpData = ["<list>",]

  for row in data:
    key = row[0]
    value = str(row[1]).replace("&", "")
    value = "".join([x for x in value if ord(x) < 128])
    kvpData.append("<stringpair><key>%s</key><value>%s</value></stringpair>" % (key, value))

  kvpData.append("</list>")
  event.source.customerList = "".join(kvpData)
```

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [October 25, 2011, 10:05pm UTC](https://forum.inductiveautomation.com/t/table-translation-map-cant-parse-non-ascii/3489/2 "2011-10-25T22:05:29Z")

</div>

I’m not quite sure what translation map you’re talking about, or where the given code is being run from.

---

<div class="post-metadata">

**Author:** ![Greg.Buehler](https://avatars.discourse-cdn.com/v4/letter/g/ecc23a/32.png) [@Greg.Buehler](https://forum.inductiveautomation.com/u/Greg.Buehler)\
**Post date:** [October 25, 2011, 10:12pm UTC](https://forum.inductiveautomation.com/t/table-translation-map-cant-parse-non-ascii/3489/3 "2011-10-25T22:12:11Z")

</div>

Checkout the binding on the columnAttributes and the scripting on the `propertyChanged` event on the table.  
[SampleDB.sql](https://us1.discourse-cdn.com/inductiveautomation/original/1X/515687ce4a1845bc4ac0f81e801c6339ce537269.sql) (27.4 KB)  
[example.vwin](https://us1.discourse-cdn.com/inductiveautomation/original/1X/09cfd4e96d36237b712efd195c684fea5c83d39d.vwin) (87.4 KB)

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [October 25, 2011, 10:56pm UTC](https://forum.inductiveautomation.com/t/table-translation-map-cant-parse-non-ascii/3489/4 "2011-10-25T22:56:41Z")

</div>

EDIT. I missed a crucial part of this: the reason that a join isn’t used is to get the nice dropdown list for the translated column for edit-ability.

[del]Wow, never seen a setup like that. Why in the world aren’t you just joining the two tables together?

As in, get rid of the customerLookup, customerList, script, the translation mapping, and the binding on column attributes data, and change the query on Data to:[/del]

`SELECT
   Co.ID,
   Cu.Name,
   Co.Firstname,
   Co.Lastname,
   Co.Title,
   Co.Phone,
   Co.Email
   FROM Contacts Co JOIN Customers Cu
       ON Co.CustomerID = Cu.id`

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [October 25, 2011, 11:28pm UTC](https://forum.inductiveautomation.com/t/table-translation-map-cant-parse-non-ascii/3489/5 "2011-10-25T23:28:24Z")

</div>

Ok, I fixed the underlying problem for the non-ascii characters. The translation map is now correctly interpreted as UTF-8.

Your script should now look like this: (you still need to escape the ampersands, but here’s the correct way to do it so that they don’t disappear)

[code]import system

print “property: " + event.propertyName  
if event.propertyName == “customerLookup”:  
data = system.dataset.toPyDataSet(event.newValue)  
kvpData = [”",]

```
for row in data:
  key = row[0]
  value = str(row[1]).replace("&", "&amp;")
  kvpData.append("<stringpair><key>%s</key><value>%s</value></stringpair>" % (key, value))

kvpData.append("</list>")
event.source.customerList = "".join(kvpData)[/code]
```
