test-charmap.py 401 B

12345678910111213141516171819202122
  1. import sys
  2. import locale
  3. reload(sys)
  4. def main():
  5. encoding = locale.getdefaultlocale()[1]
  6. if not encoding:
  7. return False
  8. sys.setdefaultencoding(encoding)
  9. textmap = {
  10. 'cp936': u'\u4e2d\u6587',
  11. 'cp1252': u'Lat\u012Bna',
  12. 'cp932': u'\u306b\u307b\u3093\u3054'
  13. }
  14. if textmap.has_key(encoding):
  15. print textmap[encoding]
  16. return True
  17. if __name__ == '__main__':
  18. print main()