Replaces restricted characters with html entities.