# Non ASCII Characters in tags inserting in to postgres database tabel

**URL:** <https://forum.inductiveautomation.com/t/non-ascii-characters-in-tags-inserting-in-to-postgres-database-tabel/61228>\
**Category:** Ignition\
**Tags:** database\
**Created:** [June 27, 2022, 9:01am UTC](https://forum.inductiveautomation.com/t/non-ascii-characters-in-tags-inserting-in-to-postgres-database-tabel/61228 "2022-06-27T09:01:39Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [June 27, 2022, 9:01am UTC](https://forum.inductiveautomation.com/t/non-ascii-characters-in-tags-inserting-in-to-postgres-database-tabel/61228/1 "2022-06-27T09:01:39Z")

</div>

Hi i am inserting a tag in to databse table

before inserting tag name  
[default]Montreal/IN40RM/Quality/Montreal\_Moulin/InspectionPoint/InspectionPointMeasures/Measure/Eau\_ **combinée\_Marmite** \_1/CharacteristicValue

inserted tag in database table  
[default]Montreal/IN40RM/Quality/Montreal\_Moulin/InspectionPoint/InspectionPointMeasures/Measure/Eau\_ **combinÃ©e\_Marmite** \_1/CharacteristicValue

how to insert the tag with Non ASCII Characters to 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:** [June 27, 2022, 11:17am UTC](https://forum.inductiveautomation.com/t/non-ascii-characters-in-tags-inserting-in-to-postgres-database-tabel/61228/2 "2022-06-27T11:17:01Z")

</div>

This is almost certainly a database configuration problem (encoding), which cannot be changed on existing tables. You will have to shut down, move the data, recreate with a UTF8 encoding, and move the data back.

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [June 27, 2022, 11:34am UTC](https://forum.inductiveautomation.com/t/non-ascii-characters-in-tags-inserting-in-to-postgres-database-tabel/61228/3 "2022-06-27T11:34:31Z")

</div>

can’t we able to do encoding for upcoming records in that table?

---

<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:** [June 27, 2022, 12:23pm UTC](https://forum.inductiveautomation.com/t/non-ascii-characters-in-tags-inserting-in-to-postgres-database-tabel/61228/4 "2022-06-27T12:23:13Z")

</div>

No, encoding in PostgreSQL is a database setting. Modern Linux distros commonly set up UTF8 encoding to avoid problems. Historical defaults for PostgreSQL are 7-bit ASCII or 8-bit Latin1, IIRC.

By shutting down, I mean the whole database and all of its tables will have to be fixed.

But look at your database’s properties to make sure this is the problem.

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [June 27, 2022, 12:39pm UTC](https://forum.inductiveautomation.com/t/non-ascii-characters-in-tags-inserting-in-to-postgres-database-tabel/61228/5 "2022-06-27T12:39:01Z")

</div>

Is there any other way can we do…

Query the records from database… can we able to do UTF8 encoding and show data in power table?

---

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [June 27, 2022, 1:33pm UTC](https://forum.inductiveautomation.com/t/non-ascii-characters-in-tags-inserting-in-to-postgres-database-tabel/61228/6 "2022-06-27T13:33:23Z")

</div>

One more reason to never use non-ASCII characters in tag names, db fields, table names, …

---

<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:** [June 27, 2022, 2:09pm UTC](https://forum.inductiveautomation.com/t/non-ascii-characters-in-tags-inserting-in-to-postgres-database-tabel/61228/7 "2022-06-27T14:09:30Z")

</div>

> [@prasath.t](#):
>
> Is there any other way can we do

If you really have a misconfigured DB, I think the answer is no. You need some amount of downtime.

Consider standing up a new DB instance at a new address, use logical replication to duplicate the data, then switch to the new instance. That would minimize your downtime (a few minutes).

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [June 28, 2022, 9:33am UTC](https://forum.inductiveautomation.com/t/non-ascii-characters-in-tags-inserting-in-to-postgres-database-tabel/61228/8 "2022-06-28T09:33:34Z")

</div>

Hi, I have checked database is configured properly.

I have used **unicode(tagname**) to insert in to database. Now its inserting properly

But i am query the record from database  
for example my record  
`[[default]Montreal/IN40RM/Quality/Montreal_Moulin/InspectionPoint/InspectionPointMeasures/Measure/Eau_combinée_Marmite _1/CharacteristicValue, [default]Montreal/IN40RM/Quality/Montreal_Moulin/InspectionPoint/InspectionPointMeasures/Measure/Eau_combinée_Marmite _1/Maxvalue]`

its in list format

but when i use Split function

i am again getting this **combinÃ©e\_Marmite** this format

how to use split without changing the format?

```auto
tagpaths = selectpath.getValueAt(0,0)
		#print type(tagpaths)
		tagpaths= tagpaths[1:-1]
		tagsplit= tagpaths.split(', ')
		#print unicode(tagsplit).decode('utf-8')
		listIn = tagsplit
		listOut = [str(i) for i in listIn]

		remove_duplicate = list(set(listOut))
		#ds = system.dataset.toDataSet(['selectedPath'], [[x] for x in listOut])
		ds = system.dataset.toDataSet(['selectedPath'], [[x] for x in remove_duplicate])

```

this is the code i am using

---

<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:** [June 28, 2022, 11:34am UTC](https://forum.inductiveautomation.com/t/non-ascii-characters-in-tags-inserting-in-to-postgres-database-tabel/61228/9 "2022-06-28T11:34:58Z")

</div>

> [@prasath.t](#):
>
> database is configured properly.

That's good.

> [@prasath.t](#):
>
> but when i use Split function

Don't use `str()`. Use `unicode()` instead. (making `listOut`)

---

<div class="post-metadata">

**Author:** ![prasath.t](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@prasath.t](https://forum.inductiveautomation.com/u/prasath.t)\
**Post date:** [June 28, 2022, 11:46am UTC](https://forum.inductiveautomation.com/t/non-ascii-characters-in-tags-inserting-in-to-postgres-database-tabel/61228/10 "2022-06-28T11:46:45Z")

</div>

> [@prasath.t](#):
>
> `tagsplit= tagpaths.split(', ')`

Its working now thanks
