python - URL returns encoded value when parsed -


i using mechanize open url , i'm parsing beautifulsoup.

br = mechanize.browser() br.addheaders = [('user-agent', 'mozilla/5.0')] url = ('xyz.html') br.open(url) print br.response().read() #prints 4 special characters soup = beautifulsoup(br.response().read())  print soup #prints encoded data 

this problem doesn't occur if copy html file locally , parse it.

should decode/encode once retrieve through mechanize? if so, how should it?


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -