Revert "Revert "fixed error causing parsers to stop processing when there's a \0 character in the input ""

This reverts commit 086b0e18b58a7c149cea55bc515fc22e5dec9c1c.
Revert "Revert "fixed broken unit test after changes in EOF handling""

This reverts commit c7b8e7b4a1901566e2d9e5224f9b7476eb678bb3.