base64 filter: Added ability to specify encoding (#39714)

* base64 filter: Added ability to specify encoding

* Added unicode chars for further testing

* Removed errors to keep previous behaviour in place

* Removed surrogate pairs due to issues loading YAML in CI
This commit is contained in:
Jordan Borean 2018-05-05 09:16:58 +10:00 committed by GitHub
parent b5cffe8ced
commit fc210a4584
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 4 deletions

View file

@ -935,6 +935,13 @@ To work with Base64 encoded strings::
{{ encoded | b64decode }}
{{ decoded | 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') }}
.. versionadded:: 2.6
To create a UUID from a string (new in version 1.9)::
{{ hostname | to_uuid }}