diff --git a/interfaces/cython/cantera/ck2cti.py b/interfaces/cython/cantera/ck2cti.py index a5d58a808..b0b958e85 100644 --- a/interfaces/cython/cantera/ck2cti.py +++ b/interfaces/cython/cantera/ck2cti.py @@ -64,15 +64,24 @@ ENERGY_UNITS = {'CAL/': 'cal/mol', 'KJOULES/MOL': 'kJ/mol', 'KJOULES/MOLE': 'kJ/mol'} +_open = open if sys.version_info[0] == 2: string_types = (str, unicode) def strip_nonascii(s): return s.decode('ascii', 'ignore') + + def open(filename, *args): + return _open(filename, *args) + else: string_types = (str,) def strip_nonascii(s): return s.encode('ascii', 'ignore').decode() + def open(filename, *args): + return _open(filename, *args, errors='ignore') + + def compatible_quantities(quantity_basis, units): if quantity_basis == 'mol': return 'molec' not in units diff --git a/test/data/pdep-test.inp b/test/data/pdep-test.inp index 84efc89d8..651d98362 100644 --- a/test/data/pdep-test.inp +++ b/test/data/pdep-test.inp @@ -1,4 +1,5 @@ ! Generic mechanism header +! This line contains a non-unicode character (–) that should just be ignored. ELEMENTS H C END