Replace invalid characters
Correct bad markup