Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base64-encoded element are not decoded #1

Open
jhenot opened this issue Feb 26, 2010 · 1 comment
Open

Base64-encoded element are not decoded #1

jhenot opened this issue Feb 26, 2010 · 1 comment

Comments

@jhenot
Copy link

jhenot commented Feb 26, 2010

According to the Amazon SimpleDB Developer Guide : "To ensure that you can read all the data you sent via REST, if a response contains invalid XML characters, Amazon SimpleDB automatically Base64-encodes the UTF-8 octets of the text. When a returned element is Base64-encoded, its encoding element is set to base64. The following example shows Base64-encoded results from a GetAttributes operation."

Base64-encoded are not decoded in _parse_attributes method.

@jhenot
Copy link
Author

jhenot commented Feb 26, 2010

So for fixing, in _parse_attributes of simpledb.py, I replace

value = attribute.find('{%s}Value' % self.ns).text

By

attValue = attribute.find('{%s}Value' % self.ns)
value = attValue.text
if len(attValue.attrib.keys()) != 0:
    if attValue.attrib.has_key('encoding'):
        value = value.decode(attValue.attrib.get("encoding"))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant