cmars / pystdf

Python module for working with STDF files
GNU General Public License v2.0
145 stars 83 forks source link

Want to read ANSI and not only ASCII char #24

Closed vgrillot closed 3 years ago

vgrillot commented 3 years ago

Hi,

I got STDF files with strings containing ANSI char like "70°C". It's not an issue as it's still only one-byte char. But as it's over ord(127), it fails when using ASCII decoding.

Then I add 2 try-except cascade, to decode with ANSI if ASCII fail, and even replace char if ANSI fail. My opinion is its better to be able to read a file with typo than not at all.

Also for DRY purposes, I don't want to duplicate above change, then I want to reuse Cn decoding for C1 token.

Hope that's clear.

PS : imports have been automatically refactored.

vgrillot commented 3 years ago

I need to cancel this PR as I introduce a new bug. Will fix it before resubmitting. And will submit a separate one for self/class issue.