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/db9dc637f15984c8/ea025f1d102698f2?hl=en&lnk=gst&q=umlaut#ea025f1d102698f2 and "IS_IN_SET multiple=True with non-ASCII character failed" http://groups.google.com/group/web2py/browse_frm/thread/545ccff33c370f9b/b779e15fd9ce6949?hl=en&lnk=gst&q=unicode+IS_IN_SET#b779e15fd9ce6949 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/db9dc637f15984c8/ea025f1d102698f2?hl=en&lnk=gst&q=umlaut#ea025f1d102698f2 # # and "IS_IN_SET multiple=True with non-ASCII character failed" # http://groups.google.com/group/web2py/browse_frm/thread/545ccff33c370f9b/b779e15fd9ce6949?hl=en&lnk=gst&q=unicode+IS_IN_SET#b779e15fd9ce6949 # # 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 --------------------------------