Code review comment for lp:~henninge/launchpad/devel-644872-unicode-error-in-search-text

Revision history for this message
Robert Collins (lifeless) wrote :

On Wed, May 4, 2011 at 8:50 PM, Henning Eggers
<email address hidden> wrote:
> I had thought about that but did not reach that conclusion (i.e. that it might already be utf-8). I suggest it should only re-encode unicode strings, or should it do some "trying out"?
>
> Somehow I wonder, though, if this might or should not be solved globally. Shouldn't the widget code take care of these issues and always present me with, say, a unicode object?

Guaranteeing that the strings inside the webapp code are unicode
objects would be pretty sane(1)(2). Alternatively programming
defensively and doing 'if type(thing) is unicode: thing =
thing.encode('utf8')' would also be sane.

1) but possibly hard: form data might be bogus or whatever. We can
probably afford to just raise UFD on those.
2) it may already be guaranteed; I'm not sure.

-Rob

« Back to merge proposal