summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJordan Borean <jborean93@gmail.com>2020-02-18 07:12:18 +1000
committerGitHub <noreply@github.com>2020-02-17 15:12:18 -0600
commit9895e18e24237587bc588012bd0d6915a9f4685e (patch)
tree3bfdf182141fc8aebf7ca394491f2a8e772b695d /docs
parenta95c76855dca5c9f85cf684253e2c957cc64c3f5 (diff)
downloadansible-9895e18e24237587bc588012bd0d6915a9f4685e.tar.gz
Clarify b64encode with Python 2 (#67488) (#67491)
(cherry picked from commit 423a900791d2cd2494a3407e4cfba62623e758cf)
Diffstat (limited to 'docs')
-rw-r--r--docs/docsite/rst/user_guide/playbooks_filters.rst7
1 files changed, 5 insertions, 2 deletions
diff --git a/docs/docsite/rst/user_guide/playbooks_filters.rst b/docs/docsite/rst/user_guide/playbooks_filters.rst
index aff571a03c..28463ee32b 100644
--- a/docs/docsite/rst/user_guide/playbooks_filters.rst
+++ b/docs/docsite/rst/user_guide/playbooks_filters.rst
@@ -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