Changed escaping so that the discovery service only escapes when format=HTML

This should fix issue #51