[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 8d95e75: utf-7 and utf-7-imap are not ASCII-compatible (bug#40407
From: |
Mattias Engdeg�rd |
Subject: |
master 8d95e75: utf-7 and utf-7-imap are not ASCII-compatible (bug#40407) |
Date: |
Mon, 6 Apr 2020 17:52:05 -0400 (EDT) |
branch: master
commit 8d95e75eb68745322a23424f1af5ab86f0cb0c3b
Author: Mattias Engdegård <address@hidden>
Commit: Mattias Engdegård <address@hidden>
utf-7 and utf-7-imap are not ASCII-compatible (bug#40407)
* lisp/international/mule-conf.el (utf-7, utf-7-imap):
Add expedient to disable the :ascii-compatible-p property set
automatically by define-coding-system.
* test/lisp/international/mule-tests.el (mule-utf-7): New test.
---
lisp/international/mule-conf.el | 5 +++++
test/lisp/international/mule-tests.el | 18 ++++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/lisp/international/mule-conf.el b/lisp/international/mule-conf.el
index e6e6135..e5ea491 100644
--- a/lisp/international/mule-conf.el
+++ b/lisp/international/mule-conf.el
@@ -1517,6 +1517,9 @@ for decoding and encoding files, process I/O, etc."
:charset-list '(unicode)
:pre-write-conversion 'utf-7-pre-write-conversion
:post-read-conversion 'utf-7-post-read-conversion)
+;; FIXME: `define-coding-system' automatically sets :ascii-compatible-p,
+;; but UTF-7 is not ASCII compatible; disable (bug#40407).
+(coding-system-put 'utf-7 :ascii-compatible-p nil)
(define-coding-system 'utf-7-imap
"UTF-7 encoding of Unicode, IMAP version (RFC 2060)"
@@ -1525,6 +1528,8 @@ for decoding and encoding files, process I/O, etc."
:charset-list '(unicode)
:pre-write-conversion 'utf-7-imap-pre-write-conversion
:post-read-conversion 'utf-7-imap-post-read-conversion)
+;; See comment for utf-7 above.
+(coding-system-put 'utf-7-imap :ascii-compatible-p nil)
;; Use us-ascii for terminal output if some other coding system is not
;; specified explicitly.
diff --git a/test/lisp/international/mule-tests.el
b/test/lisp/international/mule-tests.el
index 91e3c22..bb96943 100644
--- a/test/lisp/international/mule-tests.el
+++ b/test/lisp/international/mule-tests.el
@@ -48,6 +48,24 @@
(append (kbd "C-x RET c u t f - 8 RET C-u C-u c a b
RET") nil)))
(read-string "prompt:")))))
+(ert-deftest mule-utf-7 ()
+ ;; utf-7 and utf-7-imap are not ASCII-compatible.
+ (should-not (coding-system-get 'utf-7 :ascii-compatible-p))
+ (should-not (coding-system-get 'utf-7-imap :ascii-compatible-p))
+ ;; Invariant ASCII subset.
+ (let ((s (apply #'string (append (number-sequence #x20 #x25)
+ (number-sequence #x27 #x7e)))))
+ (should (equal (encode-coding-string s 'utf-7-imap) s))
+ (should (equal (decode-coding-string s 'utf-7-imap) s)))
+ ;; Escaped ampersand.
+ (should (equal (encode-coding-string "a&bcd" 'utf-7-imap) "a&-bcd"))
+ (should (equal (decode-coding-string "a&-bcd" 'utf-7-imap) "a&bcd"))
+ ;; Ability to encode Unicode.
+ (should (equal (check-coding-systems-region "あ" nil '(utf-7-imap)) nil))
+ (should (equal (encode-coding-string "あ" 'utf-7-imap) "&MEI-"))
+ (should (equal (decode-coding-string "&MEI-" 'utf-7-imap) "あ")))
+
+
;; Stop "Local Variables" above causing confusion when visiting this file.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 8d95e75: utf-7 and utf-7-imap are not ASCII-compatible (bug#40407),
Mattias Engdeg�rd <=