~flow wrote:
> while testing i stumbled over a problematic point that i have
> encountered (and fixed) before, and one that developers might be
> interested in: at least firefox2 has a habit of sending out urls that
> are encoded in latin-1 (or latin-9?) where that is possible (i.e.
> where all characters are encodable as latin-1), and only use utf-8
> where necessary (details are likely os- and locale-dependent; ie6 has
> a setting "send all urls in utf-8" that probably addresses this
> issue). if you know nothing about your users and their preferred
> locale, url decoding is hard since no encoding information is given in
> requests, leaving you with lots of options.
Werkzeug supports that with a custom error handling wherever Werkzeug
works with unicode:
>>> url_decode(u"foo=föö".encode("latin1"), errors="fallback:latin1")
MultiDict([('foo', u'f\xf6\xf6')])
>>> url_decode(u"foo=föö".encode("utf-8"), errors="fallback:latin1")
MultiDict([('foo', u'f\xf6\xf6')])
That can also be defined for custom request objects::
class MyRequest(Request):
encoding_errors = 'fallback:latin1'
> some people might have been a tad upset about some of my wordings, and
> i apologize if i came across in haughty or harsh ways. that was
> unintentional. i like werkzeug a lot, and coming from pylons, i can't
> really tell what i am missing for all the (e.g. architectural) freedom
> i've gained. i'm much happier with this lighter solution.
No problem here :) I happily accept patches of all kinds, but if
something is already more complex than necessary and further complexity
would be introduced just to fix/improve such a small edge case I vote for
not fixing it. At least not for the time being.
But I noted it down and try to fix that when I have time to clean up the
routing system a bit.
Regards,
Armin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pocoo-libs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pocoo-libs?hl=en
-~----------~----~----~----~------~----~------~--~---