# HG changeset patch # User aidan # Date 1109973583 0 # Node ID b921e3d0ac3e05d93effade356af822a65f4b6e1 # Parent a94fafdc4b7d5d95cfe70568bcf35eae0deefc54 [xemacs-hg @ 2005-03-04 21:59:42 by aidan] Add encode-char and decode-char functions, for wider Mule compatibility. They do unicode-to-char and char-to-unicode, and are implemented in Mule-UCS and GNU Emacs. diff -r a94fafdc4b7d -r b921e3d0ac3e lisp/ChangeLog --- a/lisp/ChangeLog Thu Mar 03 22:51:13 2005 +0000 +++ b/lisp/ChangeLog Fri Mar 04 21:59:43 2005 +0000 @@ -1,3 +1,13 @@ +2005-03-04 Aidan Kehoe + + * unicode.el (decode-char): New. This is what the FSF Mule API + calls unicode-to-char. The API of the function is more general, + but support for anything beyond Unicode isn't implemented, and I + can't see why it would be, given that make-char does a fine job + already. + * unicode.el (encode-char): New. This is what the FSF Mule calls + char-to-unicode. + 2005-02-28 Simon Josefsson * about.el (xemacs-hackers): Add jas. diff -r a94fafdc4b7d -r b921e3d0ac3e lisp/unicode.el --- a/lisp/unicode.el Thu Mar 03 22:51:13 2005 +0000 +++ b/lisp/unicode.el Fri Mar 04 21:59:43 2005 +0000 @@ -304,6 +304,20 @@ little-endian t need-bom t)) +(defun decode-char (quote-ucs code &optional restriction) + "FSF compatibility--return Mule character with Unicode codepoint `code'. +The second argument must be 'ucs, the third argument is ignored. " + (assert (eq quote-ucs 'ucs) + "Sorry, decode-char doesn't yet support anything but the UCS. ") + (unicode-to-char code)) + +(defun encode-char (char quote-ucs &optional restriction) + "FSF compatibility--return the Unicode code point of `char'. +The second argument must be 'ucs, the third argument is ignored. " + (assert (eq quote-ucs 'ucs) + "Sorry, encode-char doesn't yet support anything but the UCS. ") + (char-to-unicode char)) + ;; #### UTF-7 is not yet implemented, and it's tricky to do. There's ;; an implementation in appendix A.1 of the Unicode Standard, Version ;; 2.0, but I don't know its licensing characteristics.