Backport into the 21st century

Change the buffer code and do not output anything if there's nothing to escape.

/cc @tmm1