res.format() now includes charset. Fixes #1744
Minor refactor of res.format
Merge pull request #1747 from sorribas/master

res.format() now includes charset.