Replace invalid characters.