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

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

Postby 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?
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

Postby AlexP » Thu 01 Dec 2016 07:16

hello,

You need to turn on the UseUnicode option on the Advanced Settings tab
AlexP
Devart Team
 
Posts: 5528
Joined: Tue 10 Aug 2010 11:35

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

Postby 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?
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

Postby 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
AlexP
Devart Team
 
Posts: 5528
Joined: Tue 10 Aug 2010 11:35

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

Postby 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"))
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

Postby 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
AlexP
Devart Team
 
Posts: 5528
Joined: Tue 10 Aug 2010 11:35


Return to ODBC Drivers