mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
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:
parent
b5cffe8ced
commit
fc210a4584
4 changed files with 22 additions and 4 deletions
|
@ -459,12 +459,12 @@ def do_groupby(environment, value, attribute):
|
|||
return [tuple(t) for t in _do_groupby(environment, value, attribute)]
|
||||
|
||||
|
||||
def b64encode(string):
|
||||
return to_text(base64.b64encode(to_bytes(string, errors='surrogate_or_strict')))
|
||||
def b64encode(string, encoding='utf-8'):
|
||||
return to_text(base64.b64encode(to_bytes(string, encoding=encoding, errors='surrogate_or_strict')))
|
||||
|
||||
|
||||
def b64decode(string):
|
||||
return to_text(base64.b64decode(to_bytes(string, errors='surrogate_or_strict')))
|
||||
def b64decode(string, encoding='utf-8'):
|
||||
return to_text(base64.b64decode(to_bytes(string, errors='surrogate_or_strict')), encoding=encoding)
|
||||
|
||||
|
||||
def flatten(mylist, levels=None):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue