mercurial/hgweb/server.py
branchstable
changeset 20529 ca970d6acedb
parent 20357 6863d42eb59a
child 23070 c289fb3624b8
equal deleted inserted replaced
20523:f2a0a0e76b4c 20529:ca970d6acedb
   329         # Python 2.x's mimetypes module attempts to decode strings
   329         # Python 2.x's mimetypes module attempts to decode strings
   330         # from Windows' ANSI APIs as ascii (fail), then re-encode them
   330         # from Windows' ANSI APIs as ascii (fail), then re-encode them
   331         # as ascii (clown fail), because the default Python Unicode
   331         # as ascii (clown fail), because the default Python Unicode
   332         # codec is hardcoded as ascii.
   332         # codec is hardcoded as ascii.
   333 
   333 
       
   334         sys.argv # unwrap demand-loader so that reload() works
   334         reload(sys) # resurrect sys.setdefaultencoding()
   335         reload(sys) # resurrect sys.setdefaultencoding()
   335         oldenc = sys.getdefaultencoding()
   336         oldenc = sys.getdefaultencoding()
   336         sys.setdefaultencoding("latin1") # or any full 8-bit encoding
   337         sys.setdefaultencoding("latin1") # or any full 8-bit encoding
   337         mimetypes.init()
   338         mimetypes.init()
   338         sys.setdefaultencoding(oldenc)
   339         sys.setdefaultencoding(oldenc)