8000 docs/library/ubinascii: Update base64 docs. · sparkfun/circuitpython@0aa1d3f · GitHub
[go: up one dir, main page]

Skip to content

Commit 0aa1d3f

Browse files
alex-robbinspfalcon
authored andcommitted
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).
1 parent c89254f commit 0aa1d3f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

docs/library/ubinascii.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,12 @@ Functions
2929

3030
.. function:: a2b_base64(data)
3131

32-
Convert Base64-encoded data to binary representation. Returns bytes string.
32+
Decode base64-encoded data, ignoring invalid characters in the input.
33+
Conforms to `RFC 2045 s.6.8 <https://tools.ietf.org/html/rfc2045#section-6.8>`_.
34+
Returns a bytes object.
3335

3436
.. function:: b2a_base64(data)
3537

36-
Encode binary data in Base64 format. Returns string.
38+
Encode binary data in base64 format, as in `RFC 3548
39+
<https://tools.ietf.org/html/rfc3548.html>`_. Returns the encoded data
40+
followed by a newline character, as a bytes object.

0 commit comments

Comments
 (0)
0