Solution 1

Solution 2

Emacs lets you do find replace with replacement being a elisp function. Here's a outline of the solution.

Open the file.

Alt+xquery-replace-regexp.

Give the regex &#\([0-9]+\);. This will match HTML entity and capture the decimal code.

In the replacement input, tell emacs to use a elisp function, like this: \,(ff), where the “ff” is my function name.

Then, type y or n for each match, or type ! to replace all occurrences in the file.

The key here is writing the replacement function ff.

Your function ff will take the matched string, then return a Unicode character that has the code point of the matched string. For example, if the matched string is "945", then ff should return the string "α".

Here's the code:

(defun ff ()
"temp function. Returns a string based on current regex match.
This is for the regex: &#\\([0-9]+\\);"
(char-to-string (string-to-number (match-string 1)))
)