Hello and thank you very much for your fast answer. Indeed, adding the following comment
# -*- coding: utf-8 -*- as first line to the controller file solves the problem with the function test2(). Best regards, Toni On Aug 21, 11:32 pm, mdipierro <[email protected]> wrote: > They can but you have to use utf8, not unicode. This is because the > GET and POST vars are bytes not uncode. > > On Aug 21, 1:51 pm, "[email protected]" <[email protected]> wrote: > > > Hello Everybody, > > > I will post the same code snippet twice to handle two completely > > different questions. > > > In this thread I would like to as the following question: > > > The Validator IS_IN_SET(...) cannot handle language specific special > > chars > > > There allready were threads "Validators and non ASCII > > characters"http://groups.google.com/group/web2py/browse_frm/thread/db9dc637f1598... > > > and "IS_IN_SET multiple=True with non-ASCII character > > failed"http://groups.google.com/group/web2py/browse_frm/thread/545ccff33c370... > > > on groups.google.com. The second thread offered a solution, but it > > seems to me not satisfying. Is there any other possibility to solve > > this issue? > > > What is the reason that the validators cannot handle non-ascii > > characters (while python can...)? > > > Thanks for helping! > > > Best regards and greetings from sunny Bavaria, > > Toni > > > And here comes the code (again): > > > 8<---- HEAD OF CODE -------------------------------- > > > # One Issue: redirect does not work from launchpad revision 2223 on to > > latest (2225) > > def index(): > > session.flash = T('Welcome to my web2py page!') > > redirect(URL(request.application,'test', f='test1')) > > > # And one Question: Validator IS_IN_SET(...) cannot handle language > > specific special chars > > # > > # There allready were threads "Validators and non ASCII characters" > > #http://groups.google.com/group/web2py/browse_frm/thread/db9dc637f1598... > > # > > # and "IS_IN_SET multiple=True with non-ASCII character failed" > > #http://groups.google.com/group/web2py/browse_frm/thread/545ccff33c370... > > # > > # on groups.google.com. The second thread offered a solution, but it > > seems to me not satisfying. Is there any other possibility to solve > > this issue? > > # > > # What is the reason that the validators cannot handle non-ascii > > characters (while python can...)? > > > # compare test1() to test2() > > > def test1(): > > job_locationOptions = [ > > u'Munich', > > u'Germering', > > u'Groebenzell', > > ] > > formA = SQLFORM.factory( > > Field('job_LOCATION', > > requires=IS_IN_SET(job_locationOptions), > > default = job_locationOptions[0]), > > ) > > if formA.accepts(request.vars, session): > > response.flash = 'form accepted' > > > return dict(form = formA) > > > def test2(): > > job_locationOptions = [ > > u'München', > > u'Germering', > > u'Gröbenzell', > > ] > > formB = SQLFORM.factory( > > Field('job_LOCATION', > > requires=IS_IN_SET(job_locationOptions), > > default = job_locationOptions[0]), > > ) > > > if formB.accepts(request.vars, session): > > response.flash = 'form accepted' > > > return dict(form = formB) > > > 8<---- TAIL OF CODE --------------------------------

