Why not utf-8-sig, though? It handles optional BOMs. Had to fix a script last week that choked on it.
replies(3):
For UTF-16/32, knowing the endianness doesn't seem to be a frivolous functionality. And in fact, having to use heuristics-based detection via uchardet is a big mess, some kind of header should have been standardized since the start.