# Json to CSV special unit symbol conversion issue

**URL:** <https://forum.inductiveautomation.com/t/json-to-csv-special-unit-symbol-conversion-issue/114751>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [March 30, 2026, 7:13am UTC](https://forum.inductiveautomation.com/t/json-to-csv-special-unit-symbol-conversion-issue/114751 "2026-03-30T07:13:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jatin.aggarwal](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@jatin.aggarwal](https://forum.inductiveautomation.com/u/jatin.aggarwal)\
**Post date:** [March 30, 2026, 7:13am UTC](https://forum.inductiveautomation.com/t/json-to-csv-special-unit-symbol-conversion-issue/114751/1 "2026-03-30T07:13:47Z")

</div>

I am executing a script which is converting table to json script and then further into csv. During this process the Json contains degree Celsius in \xb0c format and upon csv download it comes as Ã‚Â° C.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [March 30, 2026, 8:50am UTC](https://forum.inductiveautomation.com/t/json-to-csv-special-unit-symbol-conversion-issue/114751/2 "2026-03-30T08:50:36Z")

</div>

You’re going to have to give us more information, eg your code, in order for us to know what you're doing to be able to help

---

<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:** [March 30, 2026, 4:58pm UTC](https://forum.inductiveautomation.com/t/json-to-csv-special-unit-symbol-conversion-issue/114751/3 "2026-03-30T16:58:15Z")

</div>

Without code I'm going to call my shot and say that you need to use the `u` prefix to designate your string literals as unicode text rather than ASCII, because Python 2.

But yeah, share your code.

---

<div class="post-metadata">

**Author:** ![jatin.aggarwal](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@jatin.aggarwal](https://forum.inductiveautomation.com/u/jatin.aggarwal)\
**Post date:** [April 1, 2026, 7:59am UTC](https://forum.inductiveautomation.com/t/json-to-csv-special-unit-symbol-conversion-issue/114751/4 "2026-04-01T07:59:57Z")

</div>

```python
try:

    data = self.page.props.data

 

    headers = [

        'ID','ParameterName','RP','SLNo',

        'Unit','AlarmMinimum','SetPointMin','SetPoint','SeTPointMax',

        'AlarmMaximum',

        'RParameterType','DataType'

    ]

 

    def to_unicode(val):

        if val is None:

            return u""

        if isinstance(val, unicode):

            return val

        if isinstance(val, str):

            # Decode legacy byte strings correctly

            return val.decode('latin-1') # or 'cp1252'

        return unicode(val)

 

    rows = [[to_unicode(row.get(h, "")) for h in headers] for row in data]

 

    ds = system.dataset.toDataSet(headers, rows)

 

    # Convert dataset to CSV (Ignition returns Unicode text)

    csv_text = system.dataset.toCSV(ds)

 

    # Encode ONCE to UTF‑8

    csv_bytes = csv_text.encode('utf-8')

 

    system.perspective.download(

        'Recipe_{}_Excel.csv'.format(self.view.params.workcenterCode),

        csv_bytes,

        'text/csv; charset=utf-8'

    )

 

except Exception as e:

    import traceback

    logger.error(traceback.format_exc())

```

---

<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:** [April 1, 2026, 3:39pm UTC](https://forum.inductiveautomation.com/t/json-to-csv-special-unit-symbol-conversion-issue/114751/5 "2026-04-01T15:39:40Z")

</div>

Dangit, I was going to call my second shot but missed out.

Here's the line: Don't blindly trust LLMs for help coding in Ignition. They're really bad at it, because they lack the specific context of how to write good code **for Ignition**.

You don't need to do **anything** related to encoding. Your LLM led you directly up a blind alley and gave you ~double the amount of code you actually need to solve this problem:

```python
headers = [
	'ID',
	'ParameterName',
	'RP',
	'SLNo',
	'Unit',
	'AlarmMinimum',
	'SetPointMin',
	'SetPoint',
	'SeTPointMax',
	'AlarmMaximum',
	'RParameterType',
	'DataType',
]

rows = [[row.get(h, "") for h in headers] for row in self.page.props.data]

ds = system.dataset.toDataSet(headers, rows)

csv_text = system.dataset.toCSV(ds)

system.perspective.download(
	'Recipe_{}_Excel.csv'.format(self.view.params.workcenterCode),
	csv_bytes,
	'text/csv; charset=utf-8'
)

```
