[Tutor] Encoding
Dave Angel
davea at ieee.org
Mon Mar 8 03:51:43 CET 2010
Giorgio wrote:
> 2010/3/7 Dave Angel <davea at ieee.org>
>
>
>> Those two lines don't make any sense by themselves. Show us some context,
>> and we can more sensibly comment on them. And try not to use names that
>> hide built-in keywords, or Python stdlib names.
>>
>>
>
> Hi Dave,
>
> I'm considering Amazon SimpleDB as an alternative to PGSQL, but i need to
> store blobs.
>
> Amazon's FAQs says that:
>
> "Q: What kind of data can I store?
> You can store any UTF-8 string data in Amazon SimpleDB. Please refer
> to the Amazon
> Web Services Customer Agreement <http://aws.amazon.com/agreement> for
> details."
>
> This is the problem. Any idea?
>
>
>
>> DaveA
>>
>>
>
> Giorgio
>
>
>
>
You still didn't provide the full context. Are you trying to do store
binary data, or not?
Assuming you are, you could do the UUENCODE suggestion I made. Or use
base64:
base64.encodestring(/s/) wlll turn binary data into (larger) binary
data, also considered a string. The latter is ASCII, so it's irrelevant
whether it's considered utf-8 or otherwise. You store the resulting
string in your database, and use base64.decodestring(s) to reconstruct
your original.
There's 50 other ways, some more efficient, but this may be the simplest.
DaveA
More information about the Tutor
mailing list