.. note:: The JSON module does not decode data for all versions
of Python 3 so we handle the decoding ourselves.
"""
- cnfdata = cnfdata.decode('iso-8859-1')
+ if isinstance (cnfdata, bytes) is True:
+ cnfdata = from_latin1 (cnfdata)
cnf_json = json.loads(cnfdata, object_hook=make_varname_lowercase)
if is_cnf(cnf_json) is False:
raise TypeError("Invalid CNF_VAR.")
:return: the parsed cnf data
:rtype: {str, {str, str or int}}
"""
+ if isinstance (data, str):
+ data = to_latin1 (data)
state = prepare(data)
if state is None:
raise InvalidCNF("Empty input string.")