Escape null characters as \x00

Since \0 might be mistakenly interpreted as octal if followed by a
number and using literal null is in some cases interpreted as end of
string, escape null as \x00.
Merge pull request #220 from lautis/escape-null

Escape null characters as \x00