I'd have this take the character encoding as well, but not urgent in a hack!