Improve character escapes, fixes #1