I'm trying to insert a record with a filed value
u"ëLocatie"
and I get an error in sql.Table._insert at the last line:
return 'INSERT INTO %s(%s) VALUES (%s);' % (sql_t, sql_f, sql_v)
here the traceback
File "D:\Data_Python_25\support\Web2Py_DAL_support.py", line 250, in DAL_Table
Description = Value[3][:-1])
File "P:\Web2PY\web2py_src\web2py\gluon\sql.py", line 2035, in insert
query = self._insert(**fields)
File "P:\Web2PY\web2py_src\web2py\gluon\sql.py", line 2028, in _insert
return 'INSERT INTO %s(%s) VALUES (%s);' % (sql_t, sql_f, sql_v)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 35:
ordinal not in range(128)
I don't understand the problem and know what I'm doing wrong
Wwith print statements I tried to narrow the problem, and in :
def sql_represent(obj, fieldtype, dbname, db_codec='UTF-8'):
there's is this part
if isinstance(obj, unicode):
print '????', type(obj),obj
if len(obj)>0 : print ord(obj[0])
obj = obj.encode(db_codec)
print '????', type(obj)
if len(obj)>0 : print ord(obj[0])
which seems to convert the unicode to a string with byte values larger than 128.
Am I doing something wrong, or is this a bug ?
And of course far more interesting, how do I solve this problem ?
thanks,
Stef Mientki