base64 interoperability

Fredrik Lundh fredrik at pythonware.com
Fri Apr 8 18:50:07 EDT 2005


Christopher J. Bottaro wrote:

>>> Python's base64 module encodes and decodes differently than PHP's.
>>
>> really?
>
> Yeah, weird, huh?  Actually the problem is that Python puts newlines at
> every 76th char.  How do I stop Python from doing that?  I just want
> everyone on one line.

did you read the spec you were referring to?

    "The encoded output stream must be represented in lines of no more
    than 76 characters each.  All line breaks or other characters not found
    in Table 1 must be ignored by decoding software."

if you want to use a non-standard "base64 minus newlines" format, use the
replace method to get rid of the newlines.

</F> 






More information about the Python-list mailing list