Clarify b64encode with Python 2 (#67488) (#67491)

(cherry picked from commit 423a900791)
pull/67503/head
Jordan Borean 5 years ago committed by GitHub
parent a95c76855d
commit 9895e18e24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1270,12 +1270,15 @@ To get the root and extension of a path or filename (new in version 2.0)::
To work with Base64 encoded strings::
{{ encoded | b64decode }}
{{ decoded | b64encode }}
{{ decoded | string | b64encode }}
As of version 2.6, you can define the type of encoding to use, the default is ``utf-8``::
{{ encoded | b64decode(encoding='utf-16-le') }}
{{ decoded | b64encode(encoding='utf-16-le') }}
{{ decoded | string | b64encode(encoding='utf-16-le') }}
.. note:: The ``string`` filter is only required for Python 2 and ensures that text to encode is a unicode string.
Without that filter before b64encode the wrong value will be encoded.
.. versionadded:: 2.6

Loading…
Cancel
Save