jjhelmus / nmrglue

A module for working with NMR data in Python
BSD 3-Clause "New" or "Revised" License
209 stars 86 forks source link

Allow different encodings for reading JCAMP files #101

Closed andreasdoll closed 5 years ago

andreasdoll commented 5 years ago

Allow to provide a list of possible encodings for reading JCAMP files, and use the first encoding which doesn't raise an UnicodeDecodeError. Suppress such errors, except when all provided encodings fail. Keep the current behaviour by choosing the default encoding if no encoding is specified.

I'm not sure if you want to pull this, but for my purposes this is easier and more futureproof than converting the JCAMP files on operating system level.

jjhelmus commented 5 years ago

@andreasdoll I made two suggestions on how I think this should be implemented. Let me know if you need any help with this.

andreasdoll commented 5 years ago

Thanks @jjhelmus, I wasn't aware that encodings in open() is not backwards compatible. I've modified that commit according to your wishes and added the previously forgotten parameter docstring.

jjhelmus commented 5 years ago

LGTM, thanks @andreasdoll