The issue isn't garbage *in* charset=, its garbage around it, eg

["text/html";                  charset=foo       \t     ]

The old code clearly tried to handle something like this case by handling either a single space or no space in between the ";" and "charset=". However, it only handled one space and then didn't handle any other cases than that. If we're going to be handling garbage around charset, then we should handle all the cases where that might happen and not two very specific cases.

(Unless there's an http spec somewhere that says that either one or zero spaces from ";" to "charset=" is legal and everything else is malformed)