(eword-decode-string, eword-decode-region): Mention language info in doc string.
[elisp/flim.git] / eword-decode.el
index ff38088..402ca36 100644 (file)
@@ -87,7 +87,10 @@ decode the charset included in it, it is not decoded.
 
 If MUST-UNFOLD is non-nil, it unfolds and eliminates line-breaks even
 if there are in decoded encoded-words (generated by bad manner MUA
-such as a version of Net$cape)."
+such as a version of Net$cape).
+
+The language informations specified in the encoded words, if any, are
+put to the decoded text as the `mime-language' text property."
   (setq string (std11-unfold-string string))
   (let ((regexp (concat "[\n\t ]*\\(" eword-encoded-word-regexp "\\)"))
        (next 0)
@@ -98,7 +101,11 @@ such as a version of Net$cape)."
       (while match
        (setq next (match-end 0))
        (push (list (match-string 2 string) ;; charset
-                   (match-string 3 string) ;; language
+                   (when (match-beginning 3) ;; language
+                     (intern
+                      (downcase
+                       (substring string
+                                  (1+ (match-beginning 3)) (match-end 3)))))
                    (match-string 4 string) ;; encoding
                    (match-string 5 string) ;; encoded-text
                    (match-string 1 string)) ;; encoded-word
@@ -216,7 +223,10 @@ If UNFOLDING is not nil, it unfolds before decoding.
 
 If MUST-UNFOLD is non-nil, it unfolds and eliminates line-breaks even
 if there are in decoded encoded-words (generated by bad manner MUA
-such as a version of Net$cape)."
+such as a version of Net$cape).
+
+The language informations specified in the encoded words, if any, are
+put to the decoded text as the `mime-language' text property."
   (interactive "*r")
   (save-excursion
     (save-restriction
@@ -232,7 +242,11 @@ such as a version of Net$cape)."
          (while match
            (goto-char (setq end (match-end 0)))
            (push (list (match-string 2) ;; charset
-                       (match-string 3) ;; language
+                       (when (match-beginning 3) ;; language
+                         (intern
+                          (downcase
+                           (buffer-substring (1+ (match-beginning 3))
+                                             (match-end 3)))))
                        (match-string 4) ;; encoding
                        (match-string 5) ;; encoded-text
                        (match-string 1)) ;; encoded-word
@@ -713,7 +727,11 @@ be the result.")
     (while match
       (setq next (match-end 0))
       (push (list (match-string 2 string) ;; charset
-                 (match-string 3 string) ;; language
+                 (when (match-beginning 3) ;; language
+                   (intern
+                    (downcase
+                     (substring string
+                                (1+ (match-beginning 3)) (match-end 3)))))
                  (match-string 4 string) ;; encoding
                  (match-string 5 string) ;; encoded-text
                  (match-string 1 string)) ;; encoded-word