dbfread icon indicating copy to clipboard operation
dbfread copied to clipboard

Fix for DBF failing on null dates

Open neurohn opened this issue 5 years ago • 2 comments

edited date field parsing to handle NULL values

neurohn avatar Jan 31 '20 12:01 neurohn

Thanks!

Could you give me an example of the value you're getting? It looks to me like you could have null bytes inside the value?

Some notes:

  • There's no need to decode the value here. You can split and join bytes object.
  • Wouldn't a replace() do the same thing?
  • The out parentheses are not needed.

So this should work:

if data.replace(b'\x00', b'') == b'' or data.strip(b' 0') == b'':

Sorry if that was a lot for such a small change. :-) Just want to make sure that I get this right.

olemb avatar Dec 21 '20 02:12 olemb

Could you test @william-andre's fix in pull request #35? His solution is even simpler. I hope it will work for you as well.

if data.strip(b' 0\0') == b''

olemb avatar Dec 21 '20 02:12 olemb