Hi,

the following code failes. Is this related to webpy Bug#177265

Tested with webpy-0.23:

import web
web.config.db_parameters = dict(dbn='postgres', user='hugo', pw='',
db='users')
web.load()
res = web.select('users').list()
for r in res:
   print r.first_name

Georg
Hans
Andrea
Jhon
Laura
Traceback (most recent call last):
  File "<stdin>", line 2, in ?
  File "/usr/lib/python2.4/site-packages/web/webapi.py", line 182, in
write
    self.file.write(string_)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xd6' in
position 0: ordinal not in range(128)

The Error take place for the first_name Örwein (the Ö is a german
special character - called an Umlaut)

-----------------------------------
The following code works (using psycopg2 directly):
-----------------------------------
import psycopg2
import psycopg2.extensions
conn = psycopg2.connect('dbname=xhost_shop user=shop password=""')
cur=conn.cursor()
conn.set_client_encoding('UTF8')
cur=conn.cursor()
cur.execute('select first_name from xhost_shop_customer')
res = cur.fetchall()
for r in res:
    print r[0]

Georg
Hans
Andrea
Jhon
Laura
Örwein
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to