Sorry. I misread your email.
Massimo
On Aug 4, 2012, at 10:53 AM, Anthony wrote:
> I see. I think the problem is only with response.flash within Ajax
> components. The message is escaped on the server via urllib2.quote, and then
> decoded in the browser via decodeURIComponent (see source code):
>
> jQuery('.flash').html(decodeURIComponent(flash)).slideDown();
>
> The problem is that if there are any ascii encodings in flash,
> decodeURIComponent seems to expect a valid URI and throws an error otherwise,
> which is what is happening when the unicode characters are included. A
> previous version of web2py.js did the escaping in Javascript on the client
> side, but with the same effect.
>
> A fix might be to use xmlescape() to do any escaping on the server side
> (which is effectively the same as the escaping of a regular flash message),
> and then don't do any escaping or decoding on the client side -- so the above
> line would change to:
>
> jQuery('.flash').html(flash).slideDown();
>
> To do the server-side escaping, I think we can change line 552 in main.py
> from:
>
> urllib2.quote(str(response.flash).replace('\n',''))
>
> to:
>
> xmlescape(response.flash).replace('\n','')
>
> (Would also have to import xmlescape from html.py.)
>
> Anthony
>
>
> --
> -- mail from:GoogleGroups "web2py-developers" mailing list
> make speech: [email protected]
> unsubscribe: [email protected]
> details : http://groups.google.com/group/web2py-developers
> the project: http://code.google.com/p/web2py/
> official : http://www.web2py.com/
>
>
--