Skip to content

Base64-encoded element are not decoded #1

Open

Description

@jhenot

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.

Activity

  1. jhenot commented on Feb 26, 2010

    @jhenot
    Author

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions