UnicodeDecodeError with mssql3 in nvarchar field

44 views
Skip to first unread message

Tim Richardson

unread,
Dec 4, 2017, 12:26:00 AM12/4/17
to web2py-users
I have a unicode string retrieved via a query from a different database on the same Windows Server (MS SQL 2008) .
It is a name with an accent. At the time I process it, it is an intermediate variable with type unicode. 

When I try to save it to an nvarchar column, I get an error  


File "C:\Users\tim\web2py_dev\gluon\packages\dal\pydal\adapters\base.py", line 523, in update
   
raise e
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 137: ordinal not in range(128)

this is python 2.7 on Window Server 2008.
I get the error both on web2py 2.16.1 which checked-out DAL v17.11, 
and in 2.14.6 with DAL v16.03

I'm using mssql3. Apart from the connection string, I am only using lazy_tables

The database collation is Latin1_General_CI_AS
The database column was varchar up until me encountering this problem; now it is nvarchar. 
 
I don't understand this at all. Where is "ascii" coming from? Is there some lingering table migration which is confusing the DAL? 




Massimo Di Pierro

unread,
Dec 14, 2017, 3:46:55 AM12/14/17
to web2py-users
 Latin1_General_CI_AS must a configuration parameter of your database. web2py only works with utf8
Reply all
Reply to author
Forward
0 new messages