[Tutor] ascii codec cannot encode character

Alex Hall mehgcap at gmail.com
Fri Jan 28 14:02:49 CET 2011


On 1/28/11, Dave Angel <davea at ieee.org> wrote:
> 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?
For the moment it will be a Win7x64 console or a .txt file on the same
machine (this is py2.7, but 2.6 is also installed). Eventually, as
this is an api wrapper, it will go to wx for me, and probably other
gui libraries if anyone else feels like using it.
>
> DaveA
>


-- 
Have a great day,
Alex (msg sent from GMail website)
mehgcap at gmail.com; http://www.facebook.com/mehgcap


More information about the Tutor mailing list