Skip to content

Conversation

@neurohn
Copy link

@neurohn neurohn commented Jan 31, 2020

edited date field parsing to handle NULL values

@olemb
Copy link
Owner

olemb commented Dec 21, 2020

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
Copy link
Owner

olemb commented Dec 21, 2020

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''

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants