Re: [Tutor] changing unicode to ascii

2013-01-30 Thread Benjamin Fishbein
> Using text.encode("ascii", "ignore") should absolutely work. You could also > just write the file in UTF-8 if you don't absolutely need ascii by using > text.encode("utf-8"). > > Hugo You're right. It does work. I forgot to assign the result to a variable: text = text.encode("ascii", "ignore"

Re: [Tutor] changing unicode to ascii

2013-01-30 Thread Peter Otten
Benjamin Fishbein wrote: > I was trying to write text to a file and got the following error: > > UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in > position 5495: ordinal not in range(128) > > I tried several things I found online, such as: > text.encode("ascii", "ignore") > w

Re: [Tutor] changing unicode to ascii

2013-01-30 Thread Hugo Arts
On Wed, Jan 30, 2013 at 2:39 PM, Benjamin Fishbein wrote: > I was trying to write text to a file and got the following error: > > UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in > position 5495: ordinal not in range(128) > > I tried several things I found online, such as: > > t

[Tutor] changing unicode to ascii

2013-01-30 Thread Benjamin Fishbein
I was trying to write text to a file and got the following error: UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 5495: ordinal not in range(128) I tried several things I found online, such as: text.encode("ascii", "ignore") which gave me the same error and text.rep