docs/library/ubinascii: Update base64 docs.

This clarifies return values and the handling of invalid (e.g. newline)
characters.

Encoding conforms to RFC 3548, but decoding does not, as it ignores invalid
characters in base64 input. Instead, it conforms to MIME handling of base64
(RFC 2045).

Note that CPython doesn't document handling of invalid characters in
a2b_base64() docs:
https://docs.python.org/3/library/binascii.html#binascii.a2b_base64 , so
we specify it more explicitly than it, based on CPython's actual behavior
(with which MicroPython now compliant).
This commit is contained in:
Alex Robbins 2017-08-04 18:01:35 -05:00 committed by Paul Sokolovsky
parent c89254fd0f
commit 0aa1d3f447

View File

@ -29,8 +29,12 @@ Functions
.. function:: a2b_base64(data) .. function:: a2b_base64(data)
Convert Base64-encoded data to binary representation. Returns bytes string. Decode base64-encoded data, ignoring invalid characters in the input.
Conforms to `RFC 2045 s.6.8 <https://tools.ietf.org/html/rfc2045#section-6.8>`_.
Returns a bytes object.
.. function:: b2a_base64(data) .. function:: b2a_base64(data)
Encode binary data in Base64 format. Returns string. Encode binary data in base64 format, as in `RFC 3548
<https://tools.ietf.org/html/rfc3548.html>`_. Returns the encoded data
followed by a newline character, as a bytes object.