correctly escape control characters (issue #1)