I have the following:
u'\x96'
I want to convert it to the following:
'\x96'
Is there any way to do this? str()
doesn't work, and when using .encode(...)
it changes the encoding. My main goal is to be able to get the following result, so any shortcut to get there would also be accepted:
>>> '\x96'.decode("cp1252")
u'\u2013'
In other words, I have u'\x96'
and I want u'\u2013'
. Any help would be appreciated.
I'm using Python 2.7.
u'\x96'.encode('raw_unicode_escape').decode("cp1252")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With