Handling B64 encoded data in Python
<p>In my Google App Engine based app, I am fetching data from a SOAP webservice.
The problem is that one of the tag contains binary 64 encoded data. I decode it using </p>

<pre><code>decodedStr = base64.b64decode(str(content))
</code></pre>

<p>It seems that the decoding is not done correctly a I get garbage data in decodeStr. I think the problem is that the content string is falsely parsed as a unicode string instead of simple byte string</p>

<p>Can any Python guru tell me how to handle b64 encoded data in Python?</p>

<p>For now I am using this workaround</p>

<pre><code>fileContent = str(fileContent)
fileContent = fileContent[3:-3]
self.response.out.write(base64.b64decode(fileContent))
</code></pre>
