From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juergen Hoetzel Newsgroups: gmane.emacs.devel Subject: url-insert-file-contents does not use charset from a http-header Date: Sun, 13 Nov 2005 12:10:51 +0100 Message-ID: <20051113111051.GA7669@h5331.serverkompetenz.net> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="qDbXVdCdHGoSgWSk" X-Trace: sea.gmane.org 1131883870 14544 80.91.229.2 (13 Nov 2005 12:11:10 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 13 Nov 2005 12:11:10 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Nov 13 13:11:08 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EbGgk-0001Ia-9L for ged-emacs-devel@m.gmane.org; Sun, 13 Nov 2005 13:10:26 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EbGgi-0000H9-Oq for ged-emacs-devel@m.gmane.org; Sun, 13 Nov 2005 07:10:25 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EbFwQ-0006GZ-Vb for emacs-devel@gnu.org; Sun, 13 Nov 2005 06:22:35 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EbFwO-0006EL-2x for emacs-devel@gnu.org; Sun, 13 Nov 2005 06:22:33 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EbFwM-0006DW-2h for emacs-devel@gnu.org; Sun, 13 Nov 2005 06:22:30 -0500 Original-Received: from [81.169.174.146] (helo=h5331.serverkompetenz.net) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EbFwL-0005FZ-Tz for emacs-devel@gnu.org; Sun, 13 Nov 2005 06:22:30 -0500 Original-Received: from h5331.serverkompetenz.net (localhost [127.0.0.1]) by h5331.serverkompetenz.net (8.12.10/8.12.10) with ESMTP id jADBArii008024 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 13 Nov 2005 12:10:53 +0100 Original-Received: (from juergen@localhost) by h5331.serverkompetenz.net (8.12.10/8.12.10/Submit) id jADBApIx008023 for emacs-devel@gnu.org; Sun, 13 Nov 2005 12:10:51 +0100 Original-To: emacs-devel@gnu.org Content-Disposition: inline User-Agent: Mutt/1.5.8i X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:45874 Archived-At: --qDbXVdCdHGoSgWSk Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by h5331.serverkompetenz.net id jADBArii008024 Hi, I'm using emacs-cvs. Try to insert: (url-insert-file-contents "http://www.hoetzel.info/test") I changed url-insert-file-contents to use the charset supplied in a response. Patch enclosed. J=FCrgen --qDbXVdCdHGoSgWSk Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="url-insert-file-contents-charset.patch" --- url-handlers.el.orig 2005-11-13 11:53:46.000000000 +0100 +++ url-handlers.el 2005-11-13 03:12:18.000000000 +0100 @@ -202,6 +202,7 @@ (defun url-insert-file-contents (url &optional visit beg end replace) (let ((buffer (url-retrieve-synchronously url)) (handle nil) + (charset nil) (data nil)) (if (not buffer) (error "Opening input file: No such file or directory, %s" url)) @@ -215,13 +216,14 @@ (mm-destroy-parts handle) (if replace (delete-region (point-min) (point-max))) (save-excursion + (setq charset (mail-content-type-get (mm-handle-type handle) + 'charset)) (let ((start (point))) - (insert data) - ;; FIXME: for text/plain data, we sometimes receive a `charset' - ;; annotation which we could use as a hint of the locale in use - ;; at the remote site. Not sure how/if that should be done. --Stef - (decode-coding-inserted-region - start (point) url visit beg end replace))) + (if charset + (insert (mm-decode-string data (mm-charset-to-coding-system charset))) + (progn + (insert data) + (decode-coding-inserted-region start (point) url visit beg end replace))))) (list url (length data)))) (defun url-file-name-completion (url directory) --qDbXVdCdHGoSgWSk Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --qDbXVdCdHGoSgWSk--