# Python pyodbc utf-16-le error

**URL:** <https://community.dremio.com/t/python-pyodbc-utf-16-le-error/5823>\
**Category:** Uncategorized\
**Created:** [June 29, 2020, 8:46am UTC](https://community.dremio.com/t/python-pyodbc-utf-16-le-error/5823 "2020-06-29T08:46:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RayC](https://avatars.discourse-cdn.com/v4/letter/r/d78d45/32.png) [@RayC](https://community.dremio.com/u/RayC)\
**Post date:** [June 29, 2020, 8:46am UTC](https://community.dremio.com/t/python-pyodbc-utf-16-le-error/5823/1 "2020-06-29T08:46:43Z")

</div>

I’m running Dremio 4.3.1 on a Centos 7.8 server. I’m trying to connect to Dremio using Python (3.7.1) pyodbc as describe in the [Dremio docs](https://docs.dremio.com/client-applications/python.html). I’m just doing a very simple “select \* from Table” statement, which resulted in the following error:

UnicodeDecodeError: ‘utf-16-le’ codec can’t decode bytes in position 2432-2433: illegal UTF-16 surrogate

I’ve search the community forum and found a couple of posts and found: [this](https://community.dremio.com/t/how-to-support-utf16-encoding-format/571) and [this](https://community.dremio.com/t/how-to-support-utf8-encoding-format/543/5), and have tried setting dremio-env in the dremio config directory (tried each individually and together):

DREMIO\_JAVA\_EXTRA\_OPTS=’-Dsaffron.default.charset=UTF-16LE -Dsaffron.default.nationalcharset=UTF-16LE -Dsaffron.default.collation.name=UTF-16LE$en\_US’

DREMIO\_JAVA\_SERVER\_EXTRA\_OPTS=’-Dsaffron.default.charset=UTF-16LE -Dsaffron.default.nationalcharset=UTF-16LE -Dsaffron.default.collation.name=UTF-16LE$en\_US’

But nothing worked. I still get the same error. I would love to try out Dremio, so any help would be much appreciated.

---

<div class="post-metadata">

**Author:** ![RayC](https://avatars.discourse-cdn.com/v4/letter/r/d78d45/32.png) [@RayC](https://community.dremio.com/u/RayC)\
**Post date:** [June 30, 2020, 10:15am UTC](https://community.dremio.com/t/python-pyodbc-utf-16-le-error/5823/2 "2020-06-30T10:15:34Z")

</div>

The problem seems to be that MySQL recommends using character set utf8mb4. Although the Dremio UI has no trouble rendering such physical/virtual datasets, it seems calcite (I presume) does. I’ve not found options that can be used in dremio-env overcome this. Instead, I’ve cloned data into tables defined as:

```
create table xyz ( ... ) character set utf16le;

```

And this seems to work. If anyone has a better solution, please do share.
