urlsafe_b64decoding of xml node text

K

kaush

Hi All,

I am running Apache with mod_python. A post message to my server
contains an xml of the form
<a>
<b>(some base64 ur-safe-encoded data)</b>
</a>

I use minidom to parse the xml posted, and now try to decode the data
using the following

import minidom
import base64

decData = base64.urlsafe_b64decode(data) #data is the above mentioned
url-safe-encoded data

This line fails with the following error

Error : <type 'exceptions.TypeError'>
Error : character mapping must return integer, None or unicode
Error : <traceback object at 0x1b38e40>

If i run the same data through a script on the terminal, I am able to
successfully decode the data.

What could be the reason for this error? Can it be because of some
encoding introduced by minidom?

I think urlsafe_b64decode takes ascii string.

Thanks,
Kaushik
 

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

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,079
Latest member
ElidaWarin

Latest Threads

Top