Escape characters in function names. Fixes #1031.