[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Meta charset differs from Content-Type charset (was Re: sb-rss.el problem)
- From: Katsumi Yamaoka <yamaoka@xxxxxxx>
- Date: Thu, 25 Feb 2010 18:38:57 +0900
- X-ml-name: emacs-w3m
- X-mail-count: 11161
- References: <b4mfx4ro6b8.fsf@xxxxxxx> <b4m8wajo614.fsf@xxxxxxx> <20100224.171225.148512628.Administrator@X60S>
>>>>> lightcyan.area51@xxxxxxxxx wrote:
> sb-rss.elについてついでにお願いしたいのですが、文字コードの指定で、
> Content-Type: text/html; charset=ISO-2022-JP
> …
> <meta http-equiv="Content-Type" content="text/html; charset=euc-jp" />
> などとあってないところがあります。具体的には、
こんな感じでしょうか。いろんなもので試してみてもらえますか?
--- shimbun.el~ 2009-09-02 01:24:46 +0000
+++ shimbun.el 2010-02-25 09:37:15 +0000
@@ -516,10 +516,19 @@
(luna-define-generic shimbun-entity-insert (entity)
"Insert ENTITY as a MIME part.")
(luna-define-method shimbun-entity-insert ((entity shimbun-entity))
- (insert "Content-Type: " (shimbun-entity-type entity) "\n")
- (when (shimbun-entity-cid entity)
- (insert "Content-ID: <" (shimbun-entity-cid entity) ">\n"))
- (insert "\n"))
+ (let ((type (shimbun-entity-type entity))
+ (cid (shimbun-entity-cid entity))
+ (charset (shimbun-text-entity-charset entity))
+ (case-fold-search t))
+ (insert "Content-Type: " type "\n")
+ (when cid
+ (insert "Content-ID: <" cid ">\n"))
+ (insert "\n")
+ (when (and charset
+ (re-search-forward "\
+\\(<meta\\s-+http-equiv=[\"']?content-type[\"']?\\s-+content=[\"']\
+text/\\sw+\;\\s-*charset=\\).+?\\([\"'][^>]*>\\)" nil t))
+ (replace-match (concat "\\1" charset "\\2")))))
;;; Class for multipart entities:
(eval-and-compile