help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ncr (numeric character reference) to unicode


From: Miles Bader
Subject: Re: ncr (numeric character reference) to unicode
Date: Tue, 14 Apr 2009 12:07:13 +0900

"B. T. Raven" <nihil@nihilo.net> writes:
> Does any of you know whether nxhtml has the capability to convert
> sequences like this:
>
> &#1513;&#1473;&#1463;&#1500;&#1493;&#1465;&#1501;.
> (shalom in Hebrew)

The following should work:

   (defun expand-html-encoded-chars (start end)
     (interactive "r")
     (save-excursion
       (goto-char start)
       (while (re-search-forward "&#\\([0-9]+\\);" end t)
         (replace-match 
          (char-to-string
           (decode-char 'ucs (string-to-number (match-string 1))) )
          t t))))

-Miles

-- 
Guilt, n. The condition of one who is known to have committed an indiscretion,
as distinguished from the state of him who has covered his tracks.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]