And the #!encoding declaration itself will have to
be encoded in a way that is compatible with both the old and the new
encodings (not a problem for encodings that are ASCII supersets, but a
big problem for others).
The only cases of that now are UTF-16, UTF-32, and the EBCDIC variants (which are a VERY marginal case). UTF-16 and UTF-32 can be sniffed just by ignoring zero bytes, and an EBCDIC sniffer is easy, with just enough brains to figure out which national EBCDIC variant is being declared (if there is no declaration, give up). All other ASCII incompatible encodings were abandoned long ago.
John Cowan
http://vrici.lojban.org/~cowan xxxxxx@ccil.orgNo man is an island, entire of itself; every man is a piece of the
continent, a part of the main. If a clod be washed away by the sea,
Europe is the less, as well as if a promontory were, as well as if a
manor of thy friends or of thine own were: any man's death diminishes me,
because I am involved in mankind, and therefore never send to know for
whom the bell tolls; it tolls for thee. --John Donne