(defvar mm-charset-synonym-alist
'((big5 . cn-big5)
(gb2312 . cn-gb-2312)
- (iso-2022-jp-2 . iso-2022-7bit-ss2)
(x-ctext . ctext))
"A mapping from invalid charset names to the real charset names.")
(defun mm-find-charset-region (b e)
"Return a list of charsets in the region."
(cond
- ((fboundp 'find-charset-region)
+ ((and (boundp 'enable-multibyte-characters)
+ enable-multibyte-characters
+ (fboundp 'find-charset-region))
(find-charset-region b e))
((not (boundp 'current-language-environment))
(save-excursion
mm-mime-mule-charset-alist)
nil t)))
+(defun mm-quote-arg (arg)
+ "Return a version of ARG that is safe to evaluate in a shell."
+ (let ((pos 0) new-pos accum)
+ ;; *** bug: we don't handle newline characters properly
+ (while (setq new-pos (string-match "[]*[;!'`\"$\\& \t{} |()<>]" arg pos))
+ (push (substring arg pos new-pos) accum)
+ (push "\\" accum)
+ (push (list (aref arg new-pos)) accum)
+ (setq pos (1+ new-pos)))
+ (if (= pos 0)
+ arg
+ (apply 'concat (nconc (nreverse accum) (list (substring arg pos)))))))
+
(provide 'mm-util)
;;; mm-util.el ends here