Ticket #235 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

paste.fixture.TestResponse.__contains__ Can't Handle Unicode

Reported by: brendan Owned by: ianb
Priority: normal Milestone: 1.5
Component: paste Version: svn-trunk
Severity: normal Keywords:
Cc:

Description

If the body of a response and the string being looked for as the argument to __contains__ both have unicode characters, then the line return (self.body.find(s) != -1 raises a UnicodeDecodeError?. This is a problem with the body containing unicode, not the string. This can be prevented by just turning body into a unicode object rather than a string by changing the line to return (unicode(self.body, 'utf-8').find(s) -1 (or using whatever the desired encoding is).

Change History

Changed 4 years ago by ianb

Fixed in r7278

Changed 4 years ago by ianb

  • status changed from new to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.