Replace non valid xml characters when formatting error message.