all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Steve Purcell <steve@sanityinc.com>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>, 20231@debbugs.gnu.org
Subject: bug#20231: 25.0.50; package.el mangles non-ascii content in downloaded archive-contents data
Date: Sat, 11 Apr 2015 18:08:16 +0100	[thread overview]
Message-ID: <8292DA72-0898-47B2-A1C1-F7D94A52A437@sanityinc.com> (raw)
In-Reply-To: <jwv619h8ffv.fsf-monnier+emacsbugs@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 109 bytes --]

The attached patch seems reasonable and works nicely for me. Happy to modify it if necessary.

-Steve



[-- Attachment #2: archive-contents-encoding.patch --]
[-- Type: application/octet-stream, Size: 1794 bytes --]

4dc1966abf44aff8baab2bf20a395260ea640428 HEAD master
Author: Steve Purcell <steve@sanityinc.com>
Date:   Sat Apr 11 18:01:06 2015 +0100

    Assume package archive-contents are UTF8-encoded
    
    * lisp/emacs-lisp/package.el (package--read-archive-file):
    Set `coding-system-for-read' explicitly to 'utf-8 when reading the
    downloaded and cached archive-contents files, so that non-ASCII
    characters in package descriptions are displayed correctly in the
    `list-packages' menu. (Bug #20231)

1 file changed, 7 insertions(+), 6 deletions(-)
 lisp/emacs-lisp/package.el | 13 +++++++------

	Modified   lisp/emacs-lisp/package.el
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 40d02f8..dadaf27 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1279,12 +1279,13 @@ Will throw an error if the archive version is too new."
   (let ((filename (expand-file-name file package-user-dir)))
     (when (file-exists-p filename)
       (with-temp-buffer
-        (insert-file-contents-literally filename)
-        (let ((contents (read (current-buffer))))
-          (if (> (car contents) package-archive-version)
-              (error "Package archive version %d is higher than %d"
-                (car contents) package-archive-version))
-          (cdr contents))))))
+        (let ((coding-system-for-read 'utf-8))
+          (insert-file-contents filename)
+          (let ((contents (read (current-buffer))))
+            (if (> (car contents) package-archive-version)
+                (error "Package archive version %d is higher than %d"
+                       (car contents) package-archive-version))
+            (cdr contents)))))))
 
 (defun package-read-archive-contents (archive)
   "Re-read archive contents for ARCHIVE.

  parent reply	other threads:[~2015-04-11 17:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-30 16:21 bug#20231: 25.0.50; package.el mangles non-ascii content in downloaded archive-contents data Steve Purcell
2015-03-30 20:58 ` Stefan Monnier
     [not found]   ` <CD30FDF5-7F20-47B7-9DE8-7DDC1C6BC1B1@sanityinc.com>
     [not found]     ` <jwv619iauly.fsf-monnier+emacsbugs@gnu.org>
     [not found]       ` <6343E9EC-9E23-4D44-9CD1-82C26DB7CDA3@sanityinc.com>
     [not found]         ` <jwv619h8ffv.fsf-monnier+emacsbugs@gnu.org>
2015-04-11 17:08           ` Steve Purcell [this message]
2015-04-11 17:41             ` Eli Zaretskii
2015-04-11 18:48               ` Steve Purcell
2015-04-11 18:56                 ` Eli Zaretskii
2015-04-11 18:07             ` Ivan Shmakov
2015-04-11 18:35               ` Eli Zaretskii
2015-04-11 19:30                 ` Ivan Shmakov
2015-04-11 19:48                   ` Eli Zaretskii
2015-04-13 12:31                     ` Artur Malabarba
2015-04-13 14:02                       ` Stefan Monnier
2015-04-13 20:45                         ` Steve Purcell
2015-04-19 15:21                           ` Artur Malabarba
2015-04-19 15:23                             ` Steve Purcell
2015-04-19 16:40                               ` Eli Zaretskii
2015-04-19 17:01                               ` Artur Malabarba
     [not found] ` <handler.20231.D20231.14294629225589.notifdone@debbugs.gnu.org>
2015-04-19 17:06   ` bug#20231: closed (Re: bug#20231: 25.0.50; package.el mangles non-ascii content in downloaded archive-contents data) Steve Purcell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8292DA72-0898-47B2-A1C1-F7D94A52A437@sanityinc.com \
    --to=steve@sanityinc.com \
    --cc=20231@debbugs.gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.