Advertisement
Guest User

Untitled

a guest
May 22nd, 2015
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # encoding: utf-8
  3. #
  4. # Copyright (c) 2010 Doug Hellmann. All rights reserved.
  5. #
  6. """Demonstrate the representations of values using different encodings.
  7. """
  8. #end_pymotw_header
  9.  
  10. from codecs_to_hex import to_hex
  11.  
  12. text = u'pi: π'
  13.  
  14. print 'Raw :', repr(text)
  15. print 'UTF-8 :', to_hex(text.encode('utf-8'), 1)
  16. print 'UTF-16:', to_hex(text.encode('utf-16'), 2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement