On Mon, Feb 12, 2018 at 9:41 AM, Nikhil kumar <nikhilkumar...@gmail.com> wrote: > I am using pyodbc driver and the OS is RHEL 7.4. Although in my case > changing FreeTDS client charset to UTF-8 helps me read the unicode character > now. > Although I am still not able to insert the unicode characters. > >>> engine.execute("update abc.xyz set value=N'Test comment –' where id=1") > I see this getting inserted as "Test comment â??". > > Any leads here will be helpful.
use a bound parameter with a real type: from sqlalchemy import text, bindparam, Unicode engine.execute( text("update abc.xyz set value=:comment where id=1").bindparams( bindparam('comment', value='Test comment –', type_=Unicode) ) ) > > Thanks > > > On Thursday, 1 February 2018 19:32:33 UTC+5:30, Mike Bayer wrote: >> >> This has to do with the driver also. What driver and OS are you using? >> FreeTDS has to be configured in the conf settings. >> >> On Feb 1, 2018 12:50 AM, "Nikhil kumar" <nikhilk...@gmail.com> wrote: >>> >>> Hi, >>> I am using a unicode character in my python string i.e. \u2013. When I >>> try to insert this into mssql I see this character getting inserted as â?? >>> I have a similar problem when I read back a stored unicode character i.e. >>> '—' which I inserted via SQL server management studio. >>> I see the character being read as \x13. >>> >>> The hexadecimal representation of the character is \xe2\80\x93. >>> >>> SQL server - MS SQL 2014, version - 12.0 >>> >>> I tried with datatype of column as varchar and nvarchar both. I also >>> tried passing encoding as 'utf8' while creating engine, and passing charset >>> as 'utf8' in engine url. >>> >>> Let me know if I am missing anything ? >>> >>> Thanks >>> >>> -- >>> SQLAlchemy - >>> The Python SQL Toolkit and Object Relational Mapper >>> >>> http://www.sqlalchemy.org/ >>> >>> To post example code, please provide an MCVE: Minimal, Complete, and >>> Verifiable Example. See http://stackoverflow.com/help/mcve for a full >>> description. >>> --- >>> You received this message because you are subscribed to the Google Groups >>> "sqlalchemy" group. >>> To unsubscribe from this group and stop receiving emails from it, send an >>> email to sqlalchemy+...@googlegroups.com. >>> To post to this group, send email to sqlal...@googlegroups.com. >>> Visit this group at https://groups.google.com/group/sqlalchemy. >>> For more options, visit https://groups.google.com/d/optout. > > -- > SQLAlchemy - > The Python SQL Toolkit and Object Relational Mapper > > http://www.sqlalchemy.org/ > > To post example code, please provide an MCVE: Minimal, Complete, and > Verifiable Example. See http://stackoverflow.com/help/mcve for a full > description. > --- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sqlalchemy+unsubscr...@googlegroups.com. > To post to this group, send email to sqlalchemy@googlegroups.com. > Visit this group at https://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/d/optout. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.