[Tutor] ascii codec cannot encode character

Dave Angel davea at ieee.org
Fri Jan 28 10:56:38 CET 2011


On 01/-10/-28163 02:59 PM, Alex Hall wrote:
> <snip>
> I tried both of those and got a different error. I have since fixed it
> so I no longer have the exact text, but it was something about not
> supporting convertion from unicode. I finally ended up doing this:
> self.title�ta.find("title").text.encode("utf-8")
> and it seems happy enough, though I get odd characters above 128. I
> suppose it is better than a traceback, and I suspect I just have the
> wrong character set. Still, I found it very odd that unicode(string,
> errors=eplace') threw an exception.
>>

Well as I said before it would certainly have helped if you had quoted 
the entire error in the first place.  That includes the stack trace.

But now that it's gone, you could answer some of the other questions.

How are you using this  self.title value?  It's apparently a byte 
string, and you say it displays incorrectly.  But what device are you 
sending it to?  Your console on Windows, or your messagebox on wxPython? 
  Or where?

DaveA


More information about the Tutor mailing list