fork download
  1. # http://www.unicode.org/reports/tr15/
  2. import unicodedata
  3.  
  4. N = lambda c: unicodedata.normalize('NFC', c)
  5.  
  6. ohm, omega = u'\u2126\u03a9'
  7. ohm_b, omega_b = [c.encode('utf-8') for c in [ohm, omega]]
  8.  
  9. print "characters", ohm_b, omega_b
  10. print "utf-8", ohm_b == omega_b
  11. print "unicode", ohm == omega
  12. print "NFC", N(ohm) == omega
  13.  
  14.  
Success #stdin #stdout 0.01s 6932KB
stdin
Standard input is empty
stdout
characters Ω Ω
utf-8 False
unicode False
NFC True