UnicodeEncodeError: 'ascii' codec can't encode character u'\xdc' using findAll()

172 views
Skip to first unread message

humbleCoder

unread,
Sep 1, 2010, 3:59:40 AM9/1/10
to beautifulsoup
from BeautifulSoup import BeautifulSoup
import urllib2

request = urllib2.Request("http://www.google.com")
fd = urllib2.urlopen(request)
gotit = fd.read()
soup = BeautifulSoup(gotit)
soup.findAll('a') <=== exception

i am testing the code usually with ipython, i get the following error
with findAll:

UnicodeEncodeError: 'ascii' codec can't encode character u'\xdc' in
position 49: ordinal not in range(128)

any idea how to fix this problem or circumwent it?
thank you

Darius Damalakas

unread,
Sep 1, 2010, 9:56:01 AM9/1/10
to beauti...@googlegroups.com
Hmm..
I just check that on my machine, and it works fine. I am using WinXP,
Python 2.6.4


Did you try with soup.findAll(u'a') ?

2010/9/1 humbleCoder <ml...@undisclose.de>:

> --
> You received this message because you are subscribed to the Google Groups "beautifulsoup" group.
> To post to this group, send email to beauti...@googlegroups.com.
> To unsubscribe from this group, send email to beautifulsou...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/beautifulsoup?hl=en.
>
>

--
Linkėjimai, Best Regards

Darius Damalakas

Reply all
Reply to author
Forward
0 new messages