This is very annoying, look what is happening now.
With this code:
p = Project(name=project_name, user=user)
turbogears.flash("Project %s added!" % project_name)
I insert 'cão' in the form, and the result is:
Project cão added!
With this:
p = Project(name=project_name, user=user)
turbogears.flash("Project %s added!" % p.name)
the result is:
Project cão added!
And if :
p = Project(name=project_name, user=user)
turbogears.flash("Project %s %s added!" % ( p.name, project_name))
result:
2006-07-12 14:59:02,084 cherrypy.msg INFO HTTP: Page handler: <bound method Root.new_project of <ngtd.controllers.Root object at 0xb73b932c>>
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py", line 105, in _run
self.main()
File "/usr/lib/python2.4/site-packages/CherryPy- 2.2.1-py2.4.egg/cherrypy/_cphttptools.py", line 254, in main
body = page_handler(*virtual_path, **self.params)
File "<string>", line 3, in new_project
File "/usr/lib/python2.4/site-packages/TurboGears- 0.9a6-py2.4.egg/turbogears/controllers.py", line 273, in expose
output = database.run_with_transaction(
File "/usr/lib/python2.4/site-packages/TurboGears-0.9a6-py2.4.egg/turbogears/database.py", line 221, in run_with_transaction
retval = func(*args, **kw)
File "<string>", line 5, in _expose
File "/usr/lib/python2.4/site-packages/TurboGears-0.9a6-py2.4.egg/turbogears/controllers.py", line 290, in <lambda>
mapping, fragment, *args, **kw)))
File "/usr/lib/python2.4/site-packages/TurboGears-0.9a6-py2.4.egg/turbogears/controllers.py", line 314, in _execute_func
output = errorhandling.try_call(func, *args, **kw)
File "/usr/lib/python2.4/site-packages/TurboGears-0.9a6-py2.4.egg/turbogears/errorhandling.py", line 71, in try_call
return func(self, *args, **kw)
File "<string>", line 3, in new_project
File "/usr/lib/python2.4/site-packages/TurboGears-0.9a6-py2.4.egg/turbogears/identity/conditions.py", line 235, in require
return fn(self, *args, **kwargs)
File "/home/bms/Lab/ngtd/ngtd/controllers.py", line 92, in new_project
turbogears.flash("Project %s %s added!" % (p.name, project_name))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)
Well, I'm getting lost here :-)
On 7/12/06, Jorge Godoy <[EMAIL PROTECTED]> wrote:
"Bruno Silva" <[EMAIL PROTECTED]> writes:
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xe3' in position
> 80: ordinal not in range(128)
Did you follow the docs on the Wiki with regards to using I18N? I recommend
keeping *everything* in Unicode, i.e., all of your strings should be
u'strings', your database should be in UTF-8, your code should be in UTF-8,
etc.
I use it here with PostgreSQL and everything in utf-8 and I have no problems
at all.
--
Jorge Godoy <[EMAIL PROTECTED]>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
- [TurboGears] Unicode problems Bruno Silva
- [TurboGears] Re: Unicode problems Arthur Clune
- [TurboGears] Re: Unicode problems Bruno Silva
- [TurboGears] Re: Unicode problems Robin Haswell
- [TurboGears] Re: Unicode problems Bruno Silva
- [TurboGears] Re: Unicode probl... Robin Haswell
- [TurboGears] Re: Unicode p... Bruno Silva
- [TurboGears] Re: Unico... Jorge Godoy
- [TurboGears] Re: Unico... Bruno Silva
- [TurboGears] Re: Unico... Bruno Silva
- [TurboGears] Re: Unico... Bruno Silva
- [TurboGears] Re: Unico... Jorge Godoy
- [TurboGears] Re: Unico... Bruno Silva
- [TurboGears] Re: Unico... Jorge Godoy
- [TurboGears] Re: Unico... Jorge Godoy
- [TurboGears] Re: Unicode problems Jorge Vargas
- [TurboGears] Re: Unicode problems Gustavo Noronha Silva
- [TurboGears] Re: Unicode problems Robin Haswell
- [TurboGears] Re: Unicode problems pan

