http://maxischenko.in.ua/blog/entries/89/sqlobject-unicode-and-ascii-error/
HTH,
Max.
> Hi !! what happens here ??
>
> class Table(SQLObject):
> class sqlmeta:
> fromDatabase=True
>
> name = StringCol()
>
> Now, This works:
> var = 'ñ'
> Table(name=var)
>
> But this doesn't works:
> var = u'ñ'
> Table(name=var)
>
> with this traceback:
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> File
> "/usr/lib/python2.4/site-packages/SQLObject-0.7.0-py2.4.egg/sqlobject/main.py",
> line 1183, in __init__
> self._create(id, **kw)
> File
> "/usr/lib/python2.4/site-packages/SQLObject-0.7.0-py2.4.egg/sqlobject/main.py",
> line 1207, in _create
> self.set(**kw)
> File
> "/usr/lib/python2.4/site-packages/SQLObject-0.7.0-py2.4.egg/sqlobject/main.py",
> line 1068, in set
> kw[name] = dbValue = from_python(value, self._SO_validatorState)
> File
> "/usr/lib/python2.4/site-packages/SQLObject-0.7.0-py2.4.egg/sqlobject/col.py",
> line
> 498, in from_python
> return value.encode("ascii")
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xe7' in position
> 0: ordinal not in
> range(128)
>
> I need to store unicode strings what can i do ?
-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid7521&bid$8729&dat1642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss