unicode queries throw errors
Bug #177265 reported by
Aaron Swartz
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
web.py |
Fix Released
|
High
|
Anand Chitipothu |
Bug Description
>>> web.select(
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/sw/lib/
return query(qout, processed=True)
File "/sw/lib/
web.
File "/sw/lib/
out = cur.execute(
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf4' in position 0: ordinal not in range(128)
This is using psycopg2.
Related branches
Changed in webpy: | |
status: | Confirmed → Fix Committed |
Changed in webpy: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
The fix appears to be running:
import psycopg2.extensions extensions. register_ type(psycopg2. extensions. UNICODE)
psycopg2.
after psycopg2 is imported. And running:
web.ctx. db.set_ client_ encoding( 'UTF8')
after a DB cursor is created. Neither one seems to work by itself but together things seem to work properly (Unicode going in and out, as is the Python 3000 way).