ansible-jsonpatch
ansible-jsonpatch copied to clipboard
UTF-8 not supported?
I have UTF-8 encoded JSON file with string:
März_Lebensmittel
but module changes file encoding to ASCII and string becomes:
M\u00e4rz_Lebensmittel
Is UTF-8 supported?
This is dictated by the ensure_ascii
argument to json.dump()
.
If ensure_ascii is true (the default), the output is guaranteed to have all incoming non-ASCII characters escaped. If ensure_ascii is false, these characters will be output as-is.
It looks like json_patch.py
does not explicitly pass ensure_ascii
(or offer the ability to override this currently), so that parameter implicitly defaults to True and escapes non-ASCII characters as you are seeing here.
To "support" this:
- You could simply pass
ensure_ascii=False
in your own fork of json_patch.py to the variousjson.dump[s]
calls in the module - Or the module itself could be modified to add an Ansible argument (here)