Post to non-ascii groups.
authorShengHuo ZHU <zsh@cs.rochester.edu>
Wed, 17 May 2000 19:00:54 +0000 (19:00 +0000)
committerShengHuo ZHU <zsh@cs.rochester.edu>
Wed, 17 May 2000 19:00:54 +0000 (19:00 +0000)
lisp/ChangeLog
lisp/gnus-msg.el
lisp/message.el
lisp/rfc2047.el

index 16bca46..c476d57 100644 (file)
@@ -1,3 +1,11 @@
+2000-05-17 14:03:49  Shenghuo ZHU  <zsh@cs.rochester.edu>
+
+       * rfc2047.el (rfc2047-encode-message-header): Encode if the method
+       is a charset.
+       * message.el (message-send-news): Check group name charset.
+       * gnus-msg.el (gnus-post-news): Decode group name.
+       (gnus-inews-do-gcc): Encode group name.
+
 2000-05-17 10:16:32  Karl Kleinpaste <karl@charcoal.com>
 
        * gnus-art.el (gnus-emphasize-whitespace-regexp): New variable.
index fc7e57a..b84a57f 100644 (file)
@@ -474,6 +474,7 @@ header line with the old Message-ID."
                              (article-buffer 'reply)
                              (t 'message))
       (let* ((group (or group gnus-newsgroup-name))
+            (charset (gnus-group-name-charset nil group))
             (pgroup group)
             to-address to-group mailing-list to-list
             newsgroup-p)
@@ -484,7 +485,8 @@ header line with the old Message-ID."
                newsgroup-p (gnus-group-find-parameter group 'newsgroup)
                mailing-list (when gnus-mailing-list-groups
                               (string-match gnus-mailing-list-groups group))
-               group (gnus-group-real-name group)))
+               group (gnus-group-name-decode (gnus-group-real-name group)
+                                             charset)))
        (if (or (and to-group
                     (gnus-news-group-p to-group))
                newsgroup-p
@@ -1058,7 +1060,10 @@ this is a reply."
                (message-encode-message-body)
                (save-restriction
                  (message-narrow-to-headers)
-                 (let ((mail-parse-charset message-default-charset))
+                 (let ((mail-parse-charset message-default-charset)
+                       (rfc2047-header-encoding-alist
+                        (cons '("Newsgroups" . default)
+                              rfc2047-header-encoding-alist)))
                    (mail-encode-encoded-word-buffer)))
                (goto-char (point-min))
                (when (re-search-forward
index f5dbbca..0bef661 100644 (file)
@@ -2430,6 +2430,12 @@ to find out how to use this."
         (method (if (message-functionp message-post-method)
                     (funcall message-post-method arg)
                   message-post-method))
+        (group-name-charset (gnus-group-name-charset method ""))
+        (rfc2047-header-encoding-alist
+         (if group-name-charset
+             (cons (cons "Newsgroups" group-name-charset)
+                   rfc2047-header-encoding-alist)
+           rfc2047-header-encoding-alist))
         (messbuf (current-buffer))
         (message-syntax-checks
          (if arg
@@ -2450,6 +2456,10 @@ to find out how to use this."
        (message-generate-headers message-required-news-headers)
        ;; Let the user do all of the above.
        (run-hooks 'message-header-hook))
+      (if group-name-charset
+         (setq message-syntax-checks
+             (cons '(valid-newsgroups . disabled)
+                   message-syntax-checks)))
       (message-cleanup-headers)
       (if (not (message-check-news-syntax))
          nil
index ff07547..7a86311 100644 (file)
@@ -107,8 +107,7 @@ Should be called narrowed to the head of the message."
   (interactive "*")
   (save-excursion
     (goto-char (point-min))
-    (let ((alist rfc2047-header-encoding-alist)
-         elem method)
+    (let (alist elem method)
       (while (not (eobp))
        (save-restriction
          (rfc2047-narrow-to-field)
@@ -123,6 +122,8 @@ Should be called narrowed to the head of the message."
                        (point-min) (point-max) 
                        (car message-posting-charset)))
            ;; We found something that may perhaps be encoded.
+           (setq method nil
+                 alist rfc2047-header-encoding-alist)
            (while (setq elem (pop alist))
              (when (or (and (stringp (car elem))
                             (looking-at (car elem)))
@@ -133,6 +134,14 @@ Should be called narrowed to the head of the message."
             ((eq method 'mime)
              (rfc2047-encode-region (point-min) (point-max))
              (rfc2047-fold-region (point-min) (point-max)))
+            ((eq method 'default)
+             (if (and (featurep 'mule)
+                      mail-parse-charset)
+                 (mm-encode-coding-region (point-min) (point-max) 
+                                          mail-parse-charset)))
+            ((mm-coding-system-p method)
+             (if (featurep 'mule)
+                 (mm-encode-coding-region (point-min) (point-max) method)))
             ;; Hm.
             (t)))
          (goto-char (point-max)))))))