There have been a lot of posts about this, but none of the solutions
are working for me - so here's another one...

I've only discovered this with two characters, but I suspect there are
more.  If i try to put café or "Living" or humankind's into a form
field I get UnicodeEncodeErrors like so:

--------------------
Page handler: <bound method Edit.save_person of
<cha_tg.controllers.Edit instance at 0x8a856ec>>
Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/CherryPy-2.2.1-py2.5.egg/
cherrypy/_cphttptools.py", line 105, in _run
    self.main()
  File "/usr/lib/python2.5/site-packages/CherryPy-2.2.1-py2.5.egg/
cherrypy/_cphttptools.py", line 254, in main
    body = page_handler(*virtual_path, **self.params)
  File "<string>", line 3, in save_person
  File "/usr/lib/python2.5/site-packages/TurboGears-1.0.2.2-py2.5.egg/
turbogears/controllers.py", line 336, in expose
    *args, **kw)
  File "<string>", line 5, in run_with_transaction
  File "/usr/lib/python2.5/site-packages/TurboGears-1.0.2.2-py2.5.egg/
turbogears/database.py", line 303, in so_rwt
    retval = func(*args, **kw)
  File "<string>", line 5, in _expose
  File "/usr/lib/python2.5/site-packages/TurboGears-1.0.2.2-py2.5.egg/
turbogears/controllers.py", line 351, in <lambda>
    mapping, fragment, args, kw)))
  File "/usr/lib/python2.5/site-packages/TurboGears-1.0.2.2-py2.5.egg/
turbogears/controllers.py", line 378, in _execute_func
    output = errorhandling.try_call(func, *args, **kw)
  File "/usr/lib/python2.5/site-packages/TurboGears-1.0.2.2-py2.5.egg/
turbogears/errorhandling.py", line 73, in try_call
    return func(self, *args, **kw)
  File "<string>", line 3, in save_person
  File "/usr/lib/python2.5/site-packages/TurboGears-1.0.2.2-py2.5.egg/
turbogears/controllers.py", line 173, in validate
    return errorhandling.run_with_errors(errors, func, *args, **kw)
  File "/usr/lib/python2.5/site-packages/TurboGears-1.0.2.2-py2.5.egg/
turbogears/errorhandling.py", line 113, in run_with_errors
    return func(self, *args, **kw)
  File "/home/kerinin/Projects/cha_tg/cha_tg/controllers.py", line
543, in save_person
    object.__setattr__(key,data[key])
  File "<string>", line 1, in <lambda>
  File "/usr/lib/python2.5/site-packages/SQLObject-0.9.0-py2.5.egg/
sqlobject/main.py", line 1050, in _SO_setValue
    dbValue = from_python(value, self._SO_validatorState)
  File "/usr/lib/python2.5/site-packages/SQLObject-0.9.0-py2.5.egg/
sqlobject/col.py", line 532, in from_python
    return value.encode("ascii")
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in
position 193: ordinal not in range(128)
---------------------------

The character changes (é gives u'\xe9', " gives u'\u201c, " gives
u'\u201d' and ' gives u'\u2019' ) but the error is the same.  This is
a problem because Microsoft Word automatically converts cafe into
café, "Living" into "Living" and so on and my client is copy pasting
text from Word to the web page.

About my system:  Ubuntu running Python 2.5.1 (although I've seen the
same problems under multiple versions of python) and TurboGears
1.0.2.2.  I'm using MySQL for the database and SQLObject for the ORM.
Everything is basic, out-of-the-box quickstart with very little
configuration tweaking.

I've tried changing the Kid encoding, adding an XML declaration to my
templates, changing the database Collation and a few other things I
don't remember.  That doesn't mean that I did them correctly or in the
right combination though...

Thanks for any advice.
-Ryan


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to