JSON diff/preview should use utf-8 encoding where possible (#465)

pull/472/head
dgtlmoon 3 years ago committed by GitHub
parent 60a9a786e0
commit ffad5cca97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -78,7 +78,8 @@ def _parse_json(json_data, jsonpath_filter):
# Re 265 - Just return an empty string when filter not found
return ''
stripped_text_from_html = json.dumps(s, indent=4)
# Ticket #462 - allow the original encoding through, usually it's UTF-8 or similar
stripped_text_from_html = json.dumps(s, indent=4, ensure_ascii=False)
return stripped_text_from_html

@ -1,4 +1,5 @@
#!/usr/bin/python3
# coding=utf-8
import time
from flask import url_for
@ -142,7 +143,7 @@ def set_modified_response():
}
],
"boss": {
"name": "Foobar"
"name": "Örnsköldsvik"
},
"available": false
}
@ -246,8 +247,10 @@ def test_check_json_filter(client, live_server):
# Should not see this, because its not in the JSONPath we entered
res = client.get(url_for("diff_history_page", uuid="first"))
# But the change should be there, tho its hard to test the change was detected because it will show old and new versions
assert b'Foobar' in res.data
# And #462 - check we see the proper utf-8 string there
assert "Örnsköldsvik".encode('utf-8') in res.data
def test_check_json_filter_bool_val(client, live_server):

Loading…
Cancel
Save