Replace invalid characters in the input that can be caused by KVO exceptions.