diff options
| author | Stefan Monnier | 2005-04-10 19:04:09 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2005-04-10 19:04:09 +0000 |
| commit | 9d9b0de9baf587e9ecc5d1b1aca0e652fd498106 (patch) | |
| tree | 363087d89bfbd1e7ef2905c8a169c38a8229f1e6 | |
| parent | 862779db9d9256859573e1250deba623bbc87f0c (diff) | |
| download | emacs-9d9b0de9baf587e9ecc5d1b1aca0e652fd498106.tar.gz emacs-9d9b0de9baf587e9ecc5d1b1aca0e652fd498106.zip | |
(mm-string-to-multibyte): New function.
(mm-detect-coding-region): Typo.
| -rw-r--r-- | lisp/gnus/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/gnus/mm-util.el | 23 |
2 files changed, 26 insertions, 2 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 7eb877a669f..052a7fdf5fc 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2005-04-10 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * mm-util.el (mm-string-to-multibyte): New function. | ||
| 4 | (mm-detect-coding-region): Typo. | ||
| 5 | |||
| 1 | 2005-04-06 Katsumi Yamaoka <yamaoka@jpl.org> | 6 | 2005-04-06 Katsumi Yamaoka <yamaoka@jpl.org> |
| 2 | 7 | ||
| 3 | * mm-util.el (mm-coding-system-p): Don't return binary for the nil | 8 | * mm-util.el (mm-coding-system-p): Don't return binary for the nil |
diff --git a/lisp/gnus/mm-util.el b/lisp/gnus/mm-util.el index b8a739eeed6..0ee52e797d0 100644 --- a/lisp/gnus/mm-util.el +++ b/lisp/gnus/mm-util.el | |||
| @@ -72,7 +72,26 @@ | |||
| 72 | string))) | 72 | string))) |
| 73 | (string-as-unibyte . identity) | 73 | (string-as-unibyte . identity) |
| 74 | (string-make-unibyte . identity) | 74 | (string-make-unibyte . identity) |
| 75 | ;; string-as-multibyte often doesn't really do what you think it does. | ||
| 76 | ;; Example: | ||
| 77 | ;; (aref (string-as-multibyte "\201") 0) -> 129 (aka ?\201) | ||
| 78 | ;; (aref (string-as-multibyte "\300") 0) -> 192 (aka ?\300) | ||
| 79 | ;; (aref (string-as-multibyte "\300\201") 0) -> 192 (aka ?\300) | ||
| 80 | ;; (aref (string-as-multibyte "\300\201") 1) -> 129 (aka ?\201) | ||
| 81 | ;; but | ||
| 82 | ;; (aref (string-as-multibyte "\201\300") 0) -> 2240 | ||
| 83 | ;; (aref (string-as-multibyte "\201\300") 1) -> <error> | ||
| 84 | ;; Better use string-to-multibyte or encode-coding-string. | ||
| 85 | ;; If you really need string-as-multibyte somewhere it's usually | ||
| 86 | ;; because you're using the internal emacs-mule representation (maybe | ||
| 87 | ;; because you're using string-as-unibyte somewhere), which is | ||
| 88 | ;; generally a problem in itself. | ||
| 89 | ;; Here is an approximate equivalence table to help think about it: | ||
| 90 | ;; (string-as-multibyte s) ~= (decode-coding-string s 'emacs-mule) | ||
| 91 | ;; (string-to-multibyte s) ~= (decode-coding-string s 'binary) | ||
| 92 | ;; (string-make-multibyte s) ~= (decode-coding-string s locale-coding-system) | ||
| 75 | (string-as-multibyte . identity) | 93 | (string-as-multibyte . identity) |
| 94 | (string-to-multibyte . mm-string-as-multibyte) | ||
| 76 | (multibyte-string-p . ignore) | 95 | (multibyte-string-p . ignore) |
| 77 | ;; It is not a MIME function, but some MIME functions use it. | 96 | ;; It is not a MIME function, but some MIME functions use it. |
| 78 | (make-temp-file . (lambda (prefix &optional dir-flag) | 97 | (make-temp-file . (lambda (prefix &optional dir-flag) |
| @@ -938,7 +957,7 @@ If INHIBIT is non-nil, inhibit `mm-inhibit-file-name-handlers'." | |||
| 938 | (defun mm-detect-coding-region (start end) | 957 | (defun mm-detect-coding-region (start end) |
| 939 | "Like `detect-coding-region' except returning the best one." | 958 | "Like `detect-coding-region' except returning the best one." |
| 940 | (let ((coding-systems | 959 | (let ((coding-systems |
| 941 | (detect-coding-region (point) (point-max)))) | 960 | (detect-coding-region start end))) |
| 942 | (or (car-safe coding-systems) | 961 | (or (car-safe coding-systems) |
| 943 | coding-systems))) | 962 | coding-systems))) |
| 944 | (defun mm-detect-coding-region (start end) | 963 | (defun mm-detect-coding-region (start end) |
| @@ -962,5 +981,5 @@ If INHIBIT is non-nil, inhibit `mm-inhibit-file-name-handlers'." | |||
| 962 | 981 | ||
| 963 | (provide 'mm-util) | 982 | (provide 'mm-util) |
| 964 | 983 | ||
| 965 | ;;; arch-tag: 94dc5388-825d-4fd1-bfa5-2100aa351238 | 984 | ;; arch-tag: 94dc5388-825d-4fd1-bfa5-2100aa351238 |
| 966 | ;;; mm-util.el ends here | 985 | ;;; mm-util.el ends here |