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

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

This is potentially buggy:
>>> print u'foo\xce'.encode('utf8').encode('utf8')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
3: ordinal not in range(128)

Do we know that the thing being encoded is always unicode? If so, the
patch is fine. If it /might be/ bytes already re-encoding would go
boom.

« Back to merge proposal