conversion to and from unicode strings

A

abhishek

hello group,
i want to represent and store a string u'\x00\x07\xa7' as
'\x00\x07\xa7'. any ideas on how to achieve this.
 
G

Gerhard Häring

abhishek said:
hello group,
i want to represent and store a string u'\x00\x07\xa7' as
'\x00\x07\xa7'. any ideas on how to achieve this.

You want to store it in the form of the repr() of the string? It is
possible to use repr() to get a bytestring to store and to use eval() to
create a unicode string of that bytestring again. But that's just bad.

It's much better to use a encoding that can represent all Unicode
characters like UTF-8.
True

-- Gerhard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top