diff options
author | Alex Robbins <alexdotrobbins@gmail.com> | 2017-08-04 18:01:35 -0500 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2017-08-17 09:25:51 +0300 |
commit | 0aa1d3f4477f56faf3bfc2891be627b86d87a63b (patch) | |
tree | 8cbae419fbe44eaa01f13e1303b3f5182b897882 | |
parent | c89254fd0f7f4517163e095f144bfe154f47758a (diff) |
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).
-rw-r--r-- | docs/library/ubinascii.rst | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/docs/library/ubinascii.rst b/docs/library/ubinascii.rst index 0664d5b09..192d34514 100644 --- a/docs/library/ubinascii.rst +++ b/docs/library/ubinascii.rst @@ -29,8 +29,12 @@ Functions .. 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) - 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. |