Hi Duncan, Can you try applying the following patch to repoze.bfg.formish?
Index: repoze/bfg/formish/__init__.py =================================================================== --- repoze/bfg/formish/__init__.py (revision 8819) +++ repoze/bfg/formish/__init__.py (working copy) @@ -48,7 +48,8 @@ "Can not find template %s" % filename) try: return PageTemplateFile(path, parser=self.parser, - auto_reload=self.auto_reload) + auto_reload=self.auto_reload, + encoding='utf-8') except OSError: self.notexists[path] = True (IOW, add the argument "encoding='utf-8'" to the call to PageTemplateFile within the "load" method of the TemplateLoader in repoze/bfg/formish/__init__.py). - C On 4/2/10 12:17 PM, duncanid...@vectorball.com wrote: > Hello all. > > I am exploring repoze.bfg and trying to get a feeling of the whole framework > and past through the "so many things to know so little brain and time" wall :) > I read the book from cover to cover and wanted to take the opportunity to > thank the people at Repoze for the documentation and the book. > > I wanted to use formish to evaluate form creation and after much fight was > able to display my form. > But when I try to put an unicode string in the description I have a > traceback at runtime like so > " > C:\Dev\Sources\TimeCards\lib\site-packages\chameleon-1.1.1-py2.5.egg\chameleon\core\template.py", > line 180, in cook_and_render > return func(econtext, rcontext) > File "<string>", line 160, in render > File "<string>", line 1, in __str__ > UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position > 22: ordinal not in range(128) > " > > My code is > pointValue_field=schemaish.Integer(description=(u"mesure de la complexité > relative de la fiche"), > > validator=validator.All(validator.Range(min=0), validator.Required()) > ) > > of course removing the u"..." brings at runtime and expected > "File"<string>", line 185, in render > File > "C:\Dev\Sources\TimeCards\lib\site-packages\chameleon-1.1.1-py2.5.egg\chameleon\core\generation.py", > line 42, in getvalue > return ''.join(self) > UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 22: > ordinal not in range(128) > " > > all my files have the # -*- coding: utf-8 -*- stance at the top of course. > > I know unicode is a very complex beast so I wanted to know if people here > could point me at some basic obvious thing in my way of doing things or if > some parts of bfg/formish were known to have trouble with unicode string, or > if it is a formish problem entirely that I should bring to the formish > developers. > > I am willing to do tests as suggested. > > > > thanks a lot for your time. > _______________________________________________ > Repoze-dev mailing list > Repozefirstname.lastname@example.org > http://lists.repoze.org/listinfo/repoze-dev -- Chris McDonough Agendaless Consulting, Fredericksburg VA The repoze.bfg Web Application Framework Book: http://bfg.repoze.org/book _______________________________________________ Repoze-dev mailing list Repozeemail@example.com http://lists.repoze.org/listinfo/repoze-dev