Hi,
I'm new too TurboGears, and I'm starting with a very simple application.
When I fill the form with characters like "çã", turbogear gives an error like:
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe7' in position 82: ordinal not in range(128)
I read some emails here, and I tried the use_unicode=1:
sqlobject.dburi="notrans_mysql://[EMAIL PROTECTED]/myproject?use_unicode=1"
I uncoment in app.cfg the line, kid.encoding="utf-8", but still with the same results.
I'm doing something wrong, because in catwalk I can insert those characters into the table.
I have simple model with the identity and this class:
class Project(SQLObject):
name = UnicodeCol( length=255 )
user = ForeignKey("User")
In my kid template I have a simple form:
<form action="" method="post">
<fieldset>
<legend>New Project</legend>
<label for="" Name:</label>
<input type="text" name="project_name"/>
<input type="submit" value="New"/>
</fieldset>
</form>
And finally in my controllers.py I have this code:
def new_project(self, project_name=None):
if project_name:
user=identity.current.user
projects =
Project.select(
AND(Project.q.userID == user.id,
Project.q.name == project_name))
if projects.count
():
turbogears.flash("Project '%s' already exists!" % project_name)
else:
p = Project(name=project_name, user=user)
turbogears.flash("Project '%s' added to user %s!" %
(project_name, user.user_name))
return dict()
Can anyone detect the origin of this?
thank you,
Bruno
--~--~---------~--~----~------------~-------~--~----~
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 problems Robin Haswell
- [TurboGears] Re: Unicode problems Bruno Silva
- [TurboGears] Re: Unicode probl... Jorge Godoy
- [TurboGears] Re: Unicode probl... Bruno Silva
- [TurboGears] Re: Unicode probl... Bruno Silva
- [TurboGears] Re: Unicode probl... Bruno Silva

