Research experience on encode and decode of Python strings -- solving the problem of garbled code

From , 4 Years ago, written in Python, viewed 52 times.
URL https://pastebin.vip/view/1b9e43c1
  1. #!/usr/bin/env python  
  2. #coding=utf-8  
  3. s="中文"  
  4.  
  5. if isinstance(s, unicode):  
  6. #s=u"中文"  
  7.     print s.encode('gb2312')  
  8. else:  
  9. #s="中文"  
  10.     print s.decode('utf-8').encode('gb2312')  

Reply to "Research experience on encode and decode of Python strings -- solving the problem of garbled code"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website