How to set encoding for string being sent/returned by devart ASE ODBC driver

Discussion of open issues, suggestions and bugs regarding usage of ODBC Drivers
Post Reply
gerham
Posts: 12
Joined: Thu 22 Sep 2016 23:58

How to set encoding for string being sent/returned by devart ASE ODBC driver

Post by gerham » Mon 28 Nov 2016 01:53

How to set the encoding for strings being sent/returned by devart ASE ODBC driver

eg from python, I send this unicode string
u'Update Prost_Consent set ConsentRefused_ActionedBy = \\'∆h\\' where PatientID = 417

but whats get stored in ASE are hex bytes
06 68
rather than the ∆h bytes stream I sent in which was
E2 88 86 68

Is the driver set up for 8 bit ascii? How do I tell it some other encoded string is coming in?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: How to set encoding for string being sent/returned by devart ASE ODBC driver

Post by AlexP » Thu 01 Dec 2016 07:16

hello,

You need to turn on the UseUnicode option on the Advanced Settings tab

gerham
Posts: 12
Joined: Thu 22 Sep 2016 23:58

Re: How to set encoding for string being sent/returned by devart ASE ODBC driver

Post by gerham » Wed 14 Dec 2016 21:23

I am on a Mac.

What setting in the ODBC.ini file or other configuration fe does this set?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: How to set encoding for string being sent/returned by devart ASE ODBC driver

Post by AlexP » Thu 15 Dec 2016 10:58

You need to add the UseUnicode=True string in the ODBC.ini file in the DSN setting section for our driver

gerham
Posts: 12
Joined: Thu 22 Sep 2016 23:58

Re: How to set encoding for string being sent/returned by devart ASE ODBC driver

Post by gerham » Fri 23 Dec 2016 00:47

I found that the answer was with python. I needed to set the string to UTF8 before sending to pyodbc

cursor.execute(theSQL.encode("utf-8"))

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: How to set encoding for string being sent/returned by devart ASE ODBC driver

Post by AlexP » Fri 23 Dec 2016 11:39

Glad to see that you have found the solution. If you have any other questions, feel free to contact us

Post Reply