factor out escape/unescape utility functions
Created by: rvantonder
Create general functions that take a callback for characters to escape/unescape in a value and use these in our diff/symbols/scanner code.
Context: https://github.com/sourcegraph/sourcegraph/pull/17258#issuecomment-760716424