(I edited the subject, many English speakers may not know this post is written in Chinese)
I have tried this on Linux if I have this script in GB2312, I got no error but a warning: WARNING 2009-01-22 21:55:14,652 __init__.py] Response written is not UTF-8: 'utf8' codec can't decode byte 0xa3 in position 35: unexpected code byte So I guess that is possible that your python script is not in UTF-8 but GB2312 since you are using Simplified Chinese. If you save it as UTF-8, you shouldn't have any problem with Chinese. If you still want to retain the encoding, you can modify you code self.response.out.write('<html><body><p>Hello, have no thing,有了汉字就不 灵了?</p></body></html>'.decode('GB2312')) You have to decode every output statement. On Jan 22, 5:53 pm, 网页中有汉字,就会产生错误,不知是啥原因 <hjma...@gmail.com> wrote: > this code right in local development environment, but error on update > to server. > > import wsgiref.handlers > from google.appengine.ext import webapp > > class MainPage(webapp.RequestHandler): > def get(self): > self.response.headers['Content-Type'] = 'text/html; charset=utf-8' > self.response.out.write('<html><body><p>Hello, have no thing,有了汉字就不 > 灵了?</p></body></html>') > > def main(): > application = webapp.WSGIApplication( > [('/', MainPage)], > debug=True) > wsgiref.handlers.CGIHandler().run(application) > > if __name__ == "__main__": > main() > > Error: Server Error > > The server encountered an error and could not complete your request. > If the problem persists, please report your problem and mention this > error message and the query that caused it. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---