This issue is not with response.flash but with request.args. The characters 
allowed in args are fairly restrictive -- here are the regexes used: 
http://code.google.com/p/web2py/source/browse/gluon/rewrite.py#51, 
http://code.google.com/p/web2py/source/browse/gluon/rewrite.py#575.

In the LOAD() examples, try setting ajax=True and the flash should work.

Anthony

On Friday, August 3, 2012 6:23:53 PM UTC-4, mweissen wrote:
>
> I have tried:* response.flash="Auswählen"* (German for "select") and I 
> got *"Ausw%C3%A4hlen"*. Looks like urllib.quote, but why?
> And in some other contexts  I got "*Auswählen*" as expected. I could not 
> find any rule.
>
> I am using the trunk from yesterday.
>
> Then I wrote some test functions. I have written the results after each 
> block:
>
> def flash1():
>     redirect (URL('flash1a', args=['hello there']))
>     
> def flash1a():
>     response.flash=request.args[0]
>     return dict(text='done')
>
> Result:  *hello_there*  (with an underscore in place of the space)
> ------------------------------------------------------
>
> def flash2():
>     redirect (URL('flash2a', args=['hello there äöü']))
>     
> def flash2a():
>     response.flash=request.args[0]
>     return dict(text='done')
>
> Result: *Invalid request*. I thought "args" uses urllib.quote?
> ------------------------------------------------------
>
> def flash3():
>     redirect (URL('flash3a', vars=dict(t='hello there äöü')))
>     
> def flash3a():
>     response.flash=request.vars['t']
>     return dict(text='done')
>
> Result: *hello there äöü*  ok!
> ------------------------------------------------------
>
> import urllib    
>     
> def flash4():
>     response.flash='hello there äöü'
>     return dict(text='done')
>     
> Result:  *hello there äöü*  ok
> ------------------------------------------------------
>
> def flash4a():
>     response.flash=urllib.quote('hello there äöü')
>     return dict(text='done')
>         
> Result: *hello%20there%20%C3%A4%C3%B6%C3%BC*  ok
> ------------------------------------------------------
>
> def flash5():
>     redirect (URL('flash5a', args=[urllib.quote('hello there äöü')]))
>     
> def flash5a():
>     response.flash=urllib.unquote(request.args[0])
>     return dict(text='done')    
>
> Result*: invalid request*    
> ------------------------------------------------------
>
> def flash6():
>     return dict(load=LOAD('default', 'flash6a.load'))
>     
> def flash6a():
>     response.flash='hello there äöü'
>     return dict()
>
> Result: nothing!!
> ------------------------------------------------------
>
> def flash7():
>     return dict(load=LOAD('default', 'flash7a.load', vars=dict(t='hello 
> there äöü')))
>     
> def flash7a():
>     response.flash=request.vars['t']
>     return dict()
>
> Result: nothing!
>
> Some strange results, isn't it?
>
> All functions again if someone wants to try it himself:
>
> def flash1():
>     redirect (URL('flash1a', args=['hello there']))
>     
> def flash1a():
>     response.flash=request.args[0]
>     return dict(text='done')
>
> def flash2():
>     redirect (URL('flash2a', args=['hello there äöü']))
>     
> def flash2a():
>     response.flash=request.args[0]
>     return dict(text='done')
>
> def flash3():
>     redirect (URL('flash3a', vars=dict(t='hello there äöü')))
>     
> def flash3a():
>     response.flash=request.vars['t']
>     return dict(text='done')
>     
> def flash4():
>     response.flash='hello there äöü'
>     return dict(text='done')
>
> import urllib    
>     
> def flash4a():
>     response.flash=urllib.quote('hello there äöü')
>     return dict(text='done')
>         
> def flash5():
>     redirect (URL('flash5a', args=[urllib.quote('hello there äöü')]))
>     
> def flash5a():
>     response.flash=urllib.unquote(request.args[0])
>     return dict(text='done')    
>     
> def flash6():
>     return dict(load=LOAD('default', 'flash6a.load'))
>     
> def flash6a():
>     response.flash='hello there äöü'
>     return dict()
>
> def flash7():
>     return dict(load=LOAD('default', 'flash7a.load', 
> vars=dict(flash='hello there äöü')))
>     
> def flash7a():
>     response.flash=request.vars.flash
>     return dict()
>
> Any answers welcome!
> Regards, Martin
>

-- 



Reply via email to