[IronPython] How to convert from byte[] to str ?

KATO Kanryu k.kanryu at gmail.com
Fri Dec 18 03:29:34 CET 2009


How to convert from byte[] to str without converted ?

I'm saveing datas as records to System.Data.SQLite with using cPickle.
There are defined pickled data column as 'blob' type.
The cPickle.dumps() outputs as str type.
When we read 'blob' column as byte[] type.
cPickle.loads() gets str type, and I must convert from byte[] to str.

Now I call the following:

pickled = Encoding.UTF8.GetString(record.data)
data = cPickle.loads(pickled)

But, GetString sometimes failed :(

KATO Kanryu

More information about the Ironpython-users mailing list