encode-coding diagnostics?

"Ilya N. Golubev" <[email protected]> Sun, 30 May 2004 00:18:52 +0400
Newsgroups gmane.emacs.xemacs.mule
Message-ID <[email protected]>
Versions: all known, including 21.4.

Not every text may be (correctly) encoded in every coding system.
Character sets of many coding systems just do not contain all
characters that mule can represent internally.

However, `encode-coding-region' or similar functions supply no
diagnostics of unencodable characters.  It just silently encodes them
into something depending on particular coding system it encodes to.
(For example, in `raw' coding system everything outside its charset is
represented as `~'.  Some ccl coding systems (incorrectly) leave raw
8-bit input characters (from `latin-iso8859-1') intact on output.)  No
diagnostics of unencodable input characters is available.

One all where such diagnostics is particularly desirable is composing
(mime) mail.  User's recipients may have some preferences as to what
mime charset to receive.  The mail user agent should check if
particular message text may be encoded in such a preferred charset
(which is implemented as mule coding system).  If yes, encode message
with it.  If no, use some generic method (like `iso-2022-*' or
`utf-*').  (Obvious generalization is a list of charsets, most
preferred first.)

But such a checking requires diagnostics as described above.  Or it
has to use some (suboptimal) work around like encode - decode - see if
it is the same.

Am i mistaken and such a diagnostics is currently available?  If no,
is adding it planned?