Page 1 of 1

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

Posted: Mon 28 Nov 2016 01:53
by gerham
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?

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

Posted: Thu 01 Dec 2016 07:16
by AlexP
hello,

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

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

Posted: Wed 14 Dec 2016 21:23
by gerham
I am on a Mac.

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

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

Posted: Thu 15 Dec 2016 10:58
by AlexP
You need to add the UseUnicode=True string in the ODBC.ini file in the DSN setting section for our driver

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

Posted: Fri 23 Dec 2016 00:47
by gerham
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"))

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

Posted: Fri 23 Dec 2016 11:39
by AlexP
Glad to see that you have found the solution. If you have any other questions, feel free to contact us