I am reading a base64 string from xml file. The base64 string written to xml file is generated from QTc++ program. I have The Qtc++ program which parses the xml file and able to generate the data from base64 string.I want to do the same with python i am unable to figure how to read the base64 as byte array similar to QTc++. My Qt c++ code which parses the xml and decode the data file looks like below. For simplicity i am just including a part of encoded base64 string.
datastring='AAAAAAAAAAA/YGJN0vGp/D9wYk3S8an8P3iTdLxqfvo/'
QByteArray xByteArray =QByteArray::fromBase64('datastring')
QDataStream xInStream(xByteArray);
while (!xInStream.atEnd())
{
double d;
xInStream >> d;
qDebug()<<d;
pPlotCurve->addXAxisValue(d);
}
I am able to decode the data using QTc++ the output looks like [0.0, 0.002 0.004,......]
I am trying to decode the same base64 string in python, i am getting scrambled data. My Python Code is
import base64
# I parse the xml file and retrieve the data below
datastring = 'AAAAAAAAAAA/YGJN0vGp/D9wYk3S8an8P3iTdLxqfvo/'
out = base64.b64decode(datastring)
print out
When i decode this the above code i am getting scrambled data, how can i perform the same operation like the above QTc++ program and get the same output. I tried lot of methods but nothing worked.