+(defun mm-find-charset-region (b e)
+ "Return a list of charsets in the region."
+ (cond
+ ((and (boundp 'enable-multibyte-characters)
+ enable-multibyte-characters
+ (fboundp 'find-charset-region))
+ (find-charset-region b e))
+ ((not (boundp 'current-language-environment))
+ (save-excursion
+ (save-restriction
+ (narrow-to-region b e)
+ (goto-char (point-min))
+ (skip-chars-forward "\0-\177")
+ (if (eobp)
+ '(ascii)
+ (delq nil (list 'ascii mail-parse-charset))))))
+ (t
+ ;; We are in a unibyte buffer, so we futz around a bit.
+ (save-excursion
+ (save-restriction
+ (narrow-to-region b e)
+ (goto-char (point-min))
+ (let ((entry (assoc (capitalize current-language-environment)
+ language-info-alist)))
+ (skip-chars-forward "\0-\177")
+ (if (eobp)
+ '(ascii)
+ (list 'ascii (car (last (assq 'charset entry)))))))))))
+
+(defun mm-read-charset (prompt)
+ "Return a charset."
+ (intern
+ (completing-read
+ prompt
+ (mapcar (lambda (e) (list (symbol-name (car e))))
+ mm-mime-mule-charset-alist)
+ nil t)))