why my code show messy code ..

Posted by zjm1126 on Stack Overflow See other posts from Stack Overflow or by zjm1126
Published on 2010-05-22T10:34:05Z Indexed on 2010/05/22 10:40 UTC
Read the original article Hit count: 171

class sss(webapp.RequestHandler):
  def get(self):
    url = "http://www.google.com/"
    result = urlfetch.fetch(url)    
    if result.status_code == 200:
        self.response.out.write(result.content)

and this view show :

alt text

when i change code to this:

if result.status_code == 200:
        self.response.out.write(result.content.decode('utf-8').encode('gb2312'))

it show :

alt text

so ,what i should do ?

thanks

© Stack Overflow or respective owner

Related posts about python

Related posts about google-app-engine