diff --git a/pycrate_asn1rt/asnobj_str.py b/pycrate_asn1rt/asnobj_str.py index 064f13e..539a5f6 100644 --- a/pycrate_asn1rt/asnobj_str.py +++ b/pycrate_asn1rt/asnobj_str.py @@ -286,7 +286,7 @@ Specific constraints attributes: else: s = uint_to_bytes(self._val[0], self._val[1]).decode('ascii') if is_printable(s): - return ret + ' -- %s --' % s + return ret + ' -- %r --' % s else: return ret except Exception: @@ -1325,7 +1325,7 @@ Specific constraints attributes: try: s = self._val.decode('ascii') if is_printable(s): - return ret + ' -- %s --' % s + return ret + ' -- %r --' % s else: return ret except Exception: diff --git a/pycrate_asn1rt/utils.py b/pycrate_asn1rt/utils.py index b6c2509..40965be 100644 --- a/pycrate_asn1rt/utils.py +++ b/pycrate_asn1rt/utils.py @@ -361,11 +361,11 @@ def extract_charstr(text=''): re.subn('\s{0,}\n\s{0,}', '', text[1:cur])[0] -printable_str = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'\ - '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c' +_printable_str = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'\ + '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c' def is_printable(w): - return all(c in printable_str for c in w) + return all(c in _printable_str for c in w) #------------------------------------------------------------------------------# # integer factorization and rounding routine