Utility for mapping content-types to charsets

This turns out to actually be more complicated than "if it exists,
use it, otherwise latin-1".  The relevant standards are somewhat
contradictory as the world slowly moves toward the utopia that is
"UTF-8 everywhere", but especially for JSON this is important.