FWIW, I had named this with a bang as a hint that it's not like the similarly-named `extract_charset` below -- this one mutates the passed string.