How to resolve error 'UnicodeDecodeError: 'utf-8' codec can't decode byte 0x96 in position 4: invalid start byte' on Python using an ODBC Driver of TIBCO Data Virtualization?

How to resolve error 'UnicodeDecodeError: 'utf-8' codec can't decode byte 0x96 in position 4: invalid start byte' on Python using an ODBC Driver of TIBCO Data Virtualization?

book

Article ID: KB0071402

calendar_today

Updated On:

Products Versions
TIBCO Data Virtualization 8.3.1 and later, 8.4.1 and later, 8.5.1 and later, 8.6 and later.

Description

When working with the Python code, the below exception message can be seen:
------------------------------------------------------------------
"UnicodeDecodeError: 'utf-8' codec can't decode byte 0x96 in position 4: invalid start byte"
------------------------------------------------------------------

Issue/Introduction

This article explains the exception message which might pop up while working with Python code using an ODBC Driver.

Environment

All supported environment

Resolution

This exception comes because the encoding is set differently on Python code.
To resolve this issue match the encoding set on the database and on Python code. For example:

User-added image

In the above Python code encoding is set to UTF-8 which means the same encoding is set for the database as well.
After setting the same encoding it will execute successfully like below:

User-added image