Use E'' strings when dumping string literals

That is, anytime the string contains a non-printing or non-ASCII character.

Method was already (mostly) there and used when dumping to JSON. Slight tweaks to handle literals as well.

It is likely that we'll want a SET option for this sometime in the future but that wasn't attempted now.