I am not sure there is a problem here. I cannot help without seeing an
example of the data you insert.

If you do:

db.table.insert(**a)

a must be a dictionary with str key and str (ut8 encoded) values. You
cannot have unicode field names.

Massimo



On May 31, 2:40 am, Phyo Arkar <[email protected]> wrote:
> I have the exactly same problem here.
>
> Can anyone look into it? thanks alot.
>
> Stef have you found a solution?
>
>
>
>
>
>
>
> On Fri, Nov 5, 2010 at 5:47 PM, Stef Mientki <[email protected]> wrote:
>
> > 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

Reply via email to