Convert control characters to escape hex

Wasn’t working properly, node doesn’t read control chars
Added check for end in parser
Modified tests, preparing for more