Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions asn1tools/codecs/jer.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,9 +512,9 @@ def encode(self, data, indent=None):
raise e

if indent is None:
string = json.dumps(dictionary, separators=(',', ':'))
string = json.dumps(dictionary, ensure_ascii=False, separators=(',', ':'))
else:
string = json.dumps(dictionary, indent=indent)
string = json.dumps(dictionary, ensure_ascii=False, indent=indent)

return string.encode('utf-8')

Expand Down
2 changes: 1 addition & 1 deletion asn1tools/codecs/xer.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ def encode(self, data, indent=None):
if indent is not None:
indent_xml(element, indent * " ")

return ElementTree.tostring(element)
return ElementTree.tostring(element, encoding='utf-8')

def decode(self, data):
element = ElementTree.fromstring(data.decode('utf-8'))
Expand Down
4 changes: 2 additions & 2 deletions tests/test_xer.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,8 @@ def test_utf8_string(self):
datas = [
('A', u'', b'<A />'),
('A', u'bar', b'<A>bar</A>'),
('A', u'a\u1010c', b'<A>a&#4112;c</A>'),
('A', u'f → ∝', b'<A>f &#8594; &#8733;</A>')
('A', u'a\u1010c', b'<A>a\xe1\x80\x90c</A>'),
('A', u'f → ∝', b'<A>f \xe2\x86\x92 \xe2\x88\x9d</A>'),
]

for type_name, decoded, encoded in datas:
Expand Down