Converting a Mule character to UCS code point

Hrvoje Niksic <[email protected]> Wed, 15 Oct 2003 16:56:36 +0200
Newsgroups gmane.emacs.xemacs.mule
Message-ID <[email protected]>
I'm the author of a Lisp package that converts Emacs buffers to HTML.
I need the ability to convert an Emacs char to a Unicode code point,
so I can include it as "&#NNNN;" entity in HTML.

I noticed that XEmacs has several functions that look like they should
be able to do that:

* char-ucs, a built-in.  Whatever I do, (char-ucs CHAR) returns nil.
  FSF doesn't have it.  Apparently unusable or unfinished.

* char-to-ucs, part of the mule-ucs package, which takes atrociously
  long to load, but once it loads, it seems to work (at least as far
  as char-to-ucs is concerned.)  Not present in FSF.  Apparently
  obsoleted by `encode-char'.

* encode-char, also part of the mule-ucs package, and also present in
  FSF.  The interface is a bit weird (`(encode-char CHAR 'ucs)'), but
  it seems to work correctly.

Can any of these be considered stable?  Does Ben's new Unicode-aware
Mule support `encode-char'?  Note that I don't mind checking for
(fboundp 'encode-char), because I support non-Mule Emacsen anyway, but
I wouldn't like to use something that might incompatibly change the
API from under me.