[轉]Python中web.py運行後窗口顯示中文

 當本身的web程序運行起來後,窗口會輸出每次的請求信息,可是中文會顯示亂碼 web

由於默認是顯示utf-8字符,中文顯示亂碼markdown

修改Python安裝目錄/Lib/site-packages/web/httpserver.py
最後兩句spa

msg = self.format % (host, time, protocol, method, req, status) print >> outfile, utils.safestr(msg) 改爲 msg = self.format % (host, time, protocol, method, req.encode("gb2312"), status) print >> outfile, utils.safestr(msg) 
相關文章
相關標籤/搜索