Apply output escaping conditionally.

Change-Id: Ie301c3c27c55dfb0f4d3c653785ad0a35a532a95