Reputation: 1624
Currently, I have a datum saved, at ini file, it is used a QSetting class. I wonder, how I could convert it to std::string without using qt. Does anyone know how to determine the code and how decodec?
My Data:
dataID="\x1\0\0\0\xd0\x8c\x9d\xdf\x1\x15\xd1\x11\x8cz\0\xc0O\xc2\x97\xeb\x1\0\0\0Z\xa3\xa3\xc9\x18\xb5>M\xa9=)\xb4\xda\xfb{\xfe\x4\0\0\0\x2\0\0\0\0\0\x3\x66\0\0\xc0\0\0\0\x10\0\0\0|\x16>\x17\x96\xda\xc4-O\xe9\x1f!\\\aAW\0\0\0\0\x4\x80\0\0\xa0\0\0\0\x10\0\0\0\x45\xf4K\x9e\xc2k$\f\xd2\xcbK\b\xf4\xd3\xdf}(\0\0\0\xb2\xb2\xf1\x13[sy\r\xeb\xa7\x96l\x8d\xd7\xa4\xccJ\xf6M\xc1\xf3U3W\xe4\xf7\xa6\x1a\x86s`v\xc2\x8d\x99\xdf!8\xd0G\x14\0\0\0\x35\x93\xeb\xcb\xa9\x16\xadXI\xe6\x46wY\x7f\x32\xb8\xd9\xec\xfb*"
I would like to do
std::string data = convert(dataID);
where convert is a pure c++ function
Upvotes: 1
Views: 442
Reputation: 26429
Does anyone know how to determine the code and how decodec?
Yes, you can do it. Read this document.
Keep in mind that QT stores string data in datastream in UTF16 encoding, and std::string stores 8bit strings. So you'll either need some encoding conversion routines (UTF16->8bit) or just drop every character that isn't in ASCII.
Upvotes: 2