I have a data of a form:
v = \"\\xc5\\x84\"
This is a byte representation of an utf-8 encoded character \"ń\".
How can I print >>ń<< using
Edit In my machine the output depends on the shell/python used, as shown below.
As commented by Klaus a major actor here would be the locale setting in your system.
>>> v = "\xc5\x84"
>>> print v #in pycrust shell python 2.6
Å„
>>>
>>> print (v) #in idle python 3.2
Å
>>>
the machine has the following settings:
>>> import locale
>>> locale.getlocale()
('es_ES', 'cp1252')
Independently of this setting, you get your character with
>>> print v.decode('utf-8')
ń
>>>
Uhm, you don't need to do anything special... It's just print v
?
>>> v = "\xc5\x84"
>>> print v
ń