diff options
| author | Kenichi Handa | 2006-03-23 05:51:44 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2006-03-23 05:51:44 +0000 |
| commit | e9e33c19b8ae7878f448804a54c338a4d83536a1 (patch) | |
| tree | 2c4f8c5b80c0fade2028293385820ca36029a2a2 | |
| parent | 9b99ec0e6c92f9e05f823e2334ca89db6d49c583 (diff) | |
| download | emacs-e9e33c19b8ae7878f448804a54c338a4d83536a1.tar.gz emacs-e9e33c19b8ae7878f448804a54c338a4d83536a1.zip | |
(rfc2231-decode-encoded-string): Work on unibyte
buffer and then decode the buffer text if necessary.
(rfc2231-encode-string): Be sure to work on multibyte buffer at
first, and after mm-encode-body, change the buffer to unibyte.
| -rw-r--r-- | lisp/gnus/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/gnus/rfc2231.el | 11 |
2 files changed, 13 insertions, 5 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 966451cce3c..50ee745389c 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2006-03-23 Kenichi Handa <handa@m17n.org> | ||
| 2 | |||
| 3 | * rfc2231.el (rfc2231-decode-encoded-string): Work on unibyte | ||
| 4 | buffer and then decode the buffer text if necessary. | ||
| 5 | (rfc2231-encode-string): Be sure to work on multibyte buffer at | ||
| 6 | first, and after mm-encode-body, change the buffer to unibyte. | ||
| 7 | |||
| 1 | 2006-03-21 Daniel Pittman <daniel@rimspace.net> | 8 | 2006-03-21 Daniel Pittman <daniel@rimspace.net> |
| 2 | 9 | ||
| 3 | * nnimap.el (nnimap-request-update-info-internal): Optimize. | 10 | * nnimap.el (nnimap-request-update-info-internal): Optimize. |
diff --git a/lisp/gnus/rfc2231.el b/lisp/gnus/rfc2231.el index 2099b20195d..ba246278c73 100644 --- a/lisp/gnus/rfc2231.el +++ b/lisp/gnus/rfc2231.el | |||
| @@ -227,7 +227,7 @@ These look like: | |||
| 227 | (let ((coding-system (mm-charset-to-coding-system (match-string 2 string))) | 227 | (let ((coding-system (mm-charset-to-coding-system (match-string 2 string))) |
| 228 | ;;(language (match-string 3 string)) | 228 | ;;(language (match-string 3 string)) |
| 229 | (value (match-string 4 string))) | 229 | (value (match-string 4 string))) |
| 230 | (mm-with-multibyte-buffer | 230 | (mm-with-unibyte-buffer |
| 231 | (insert value) | 231 | (insert value) |
| 232 | (goto-char (point-min)) | 232 | (goto-char (point-min)) |
| 233 | (while (search-forward "%" nil t) | 233 | (while (search-forward "%" nil t) |
| @@ -236,9 +236,9 @@ These look like: | |||
| 236 | (string-to-number (buffer-substring (point) (+ (point) 2)) 16) | 236 | (string-to-number (buffer-substring (point) (+ (point) 2)) 16) |
| 237 | (delete-region (1- (point)) (+ (point) 2))))) | 237 | (delete-region (1- (point)) (+ (point) 2))))) |
| 238 | ;; Decode using the charset, if any. | 238 | ;; Decode using the charset, if any. |
| 239 | (unless (memq coding-system '(nil ascii)) | 239 | (if (memq coding-system '(nil ascii)) |
| 240 | (mm-decode-coding-region (point-min) (point-max) coding-system)) | 240 | (buffer-string) |
| 241 | (buffer-string)))) | 241 | (mm-decode-coding-string (buffer-string) coding-system))))) |
| 242 | 242 | ||
| 243 | (defun rfc2231-encode-string (param value) | 243 | (defun rfc2231-encode-string (param value) |
| 244 | "Return and PARAM=VALUE string encoded according to RFC2231. | 244 | "Return and PARAM=VALUE string encoded according to RFC2231. |
| @@ -252,7 +252,7 @@ the result of this function." | |||
| 252 | ;; Don't make lines exceeding 76 column. | 252 | ;; Don't make lines exceeding 76 column. |
| 253 | (limit (- 74 (length param))) | 253 | (limit (- 74 (length param))) |
| 254 | spacep encodep charsetp charset broken) | 254 | spacep encodep charsetp charset broken) |
| 255 | (with-temp-buffer | 255 | (mm-with-multibyte-buffer |
| 256 | (insert value) | 256 | (insert value) |
| 257 | (goto-char (point-min)) | 257 | (goto-char (point-min)) |
| 258 | (while (not (eobp)) | 258 | (while (not (eobp)) |
| @@ -268,6 +268,7 @@ the result of this function." | |||
| 268 | (forward-char 1)) | 268 | (forward-char 1)) |
| 269 | (when charsetp | 269 | (when charsetp |
| 270 | (setq charset (mm-encode-body))) | 270 | (setq charset (mm-encode-body))) |
| 271 | (set-buffer-multibyte nil) | ||
| 271 | (cond | 272 | (cond |
| 272 | ((or encodep charsetp | 273 | ((or encodep charsetp |
| 273 | (progn | 274 | (progn |