# -*- coding: utf-8 -*-
a = 'éáűőúöüó€'
print type(a) # <type 'str'>
print a # éáűőúöüó€
print ord(a[-1]) # 172
Why is this working ? Shouldn't be this a SyntaxError: Non-ASCII character '\xc3' in file ...
? There are unicode literals in the string.
When I prefix it with u
, the results are different:
# -*- coding: utf-8 -*-
a = u'éáűőúöüó€'
print type(a) # <type 'unicode'>
print a # éáűőúöüó€
print ord(a[-1]) # 8364
Why? What is the difference between the internal representations in python ? How can I see it myself ? :)