From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/65875 Path: news.gmane.org!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.gnus.general Subject: Re: gnus-article-browse-html-article' and character encoding Date: Wed, 05 Dec 2007 11:57:31 +0900 Organization: Emacsen advocacy group Message-ID: References: <873auj0xo8.fsf@ID-24456.user.uni-berlin.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1196823547 22301 80.91.229.12 (5 Dec 2007 02:59:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 5 Dec 2007 02:59:07 +0000 (UTC) Cc: ding@gnus.org, bugs@gnus.org To: Christoph Conrad Original-X-From: ding-owner+M14370@lists.math.uh.edu Wed Dec 05 03:59:16 2007 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.50) id 1IzkTj-00009G-Md for ding-account@gmane.org; Wed, 05 Dec 2007 03:59:16 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1IzkSR-0001lo-3Z; Tue, 04 Dec 2007 20:57:55 -0600 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1IzkSP-0001lW-IA for ding@lists.math.uh.edu; Tue, 04 Dec 2007 20:57:53 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtp (Exim 4.67) (envelope-from ) id 1IzkSJ-000573-46 for ding@lists.math.uh.edu; Tue, 04 Dec 2007 20:57:53 -0600 Original-Received: from orlando.hostforweb.net ([216.246.45.90]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1IzkSF-0002Kj-00; Wed, 05 Dec 2007 03:57:43 +0100 Original-Received: from [66.225.201.151] (port=36803 helo=mail.jpl.org) by orlando.hostforweb.net with esmtpa (Exim 4.68) (envelope-from ) id 1IzkSC-0000Ug-JN; Tue, 04 Dec 2007 20:57:41 -0600 X-Hashcash: 1:20:071205:christoph.conrad@gmx.de::1YUhHptPHBHCSItK:0000000000000000000000000000000000000079F4 X-Hashcash: 1:20:071205:ding@gnus.org::/VCpNJkBh6uR/C8C:00004uTF X-Hashcash: 1:20:071205:bugs@gnus.org::Rzsk/1jxCL+QH733:00000Lhh X-Face: #kKnN,xUnmKia.'[pp`;Omh}odZK)?7wQSl"4o04=EixTF+V[""w~iNbM9ZL+.b*_CxUmFk B#Fu[*?MZZH@IkN:!"\w%I_zt>[$nm7nQosZ<3eu;B:$Q_:p!',P.c0-_Cy[dz4oIpw0ESA^D*1Lw= L&i*6&( User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.50 (gnu/linux) Cancel-Lock: sha1:KXWXt8rP7A13LV9AMWPIBQZl4bc= X-Antivirus-Scanner: Clean mail though you should still use an Antivirus X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - orlando.hostforweb.net X-AntiAbuse: Original Domain - gnus.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - jpl.org X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: -2.4 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:65875 Archived-At: --=-=-= >>>>> Christoph Conrad wrote: > No Gnus v0.7 > GNU Emacs 23.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.12.1) > of 2007-11-30 on brabbelbox > 200 news.online.de InterNetNews NNRP server INN 2.3.5 ready (posting ok). > `gnus-article-browse-html-article' should write also the character > encoding of the html part to the file, e.g. with > Content-Type: text/html; > charset="UTF-8" > german umlauts are not displayed correctly if the default character > encoding is iso-8859-1. > Best regards, > Christoph Is the attached patch what you need? This will add the meta html tag that specifies the charset to an html source. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment --- gnus-art.el~ 2007-12-05 01:51:07 +0000 +++ gnus-art.el 2007-12-05 02:55:23 +0000 @@ -2803,7 +2803,34 @@ (string-match "text/html" (car (mm-handle-type handle)))) (let ((tmp-file (mm-make-temp-file ;; Do we need to care for 8.3 filenames? - "mm-" nil ".html"))) + "mm-" nil ".html")) + (charset (mail-content-type-get (mm-handle-type handle) + 'charset))) + (when charset + (with-current-buffer (mm-handle-buffer handle) + (when (eq charset 'gnus-decoded) + (insert (prog2 + (setq charset 'utf-8) + (encode-coding-string (buffer-string) + charset) + (erase-buffer) + (mm-disable-multibyte)))) + (setq charset (format "\ +" + charset)) + (goto-char (point-min)) + (let ((case-fold-search t)) + (cond ((re-search-forward "\ +]+>" + nil t) + (replace-match charset)) + ((re-search-forward "[\t\n\r ]*" nil t) + (insert charset "\n")) + (t + (re-search-forward "\ +]+\\|[\t\n\r ]*\\)>[\t\n\r ]*" + nil t) + (insert "\n" charset "\n\n")))))) (mm-save-part-to-file handle tmp-file) (add-to-list 'gnus-article-browse-html-temp-list tmp-file) (add-hook 'gnus-summary-prepare-exit-hook --=-=-=--