The 'decode' call fails in what is already a unicode string. I'm not sure under what circumstances the string is or isn't unicode (apparently it varies), so I added a check. The test passes with the patch, at least.