Subject: Re: bug#20010: 24.4; Issue with Unicode characters in package description

From: Stefan Monnier <[email-masked]>
Date: Sun, 15 Mar 2015 14:25:28 -0400

> (package-refresh-contents)
> A popup buffer will always be shown, stating:
> These default coding systems were tried to encode text
> in the buffer ` *temp*':

Indeed, we have a problem in package.el because we use the same routine
in two cases: one where we just want to transfer bytes (typically, to
download an package or the `archive-contents' file), and the other
where we want to see actual characters (when we fetch the *-readme.txt).

I installed the following patch which should at lease fix the immediate
problem you're seeing, tho there may still be corner cases where the bug
will appear.

        Stefan

diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el
index 23006e1..ff3eafd 100644
--- a/lisp/url/url-handlers.el
+++ b/lisp/url/url-handlers.el
@@ -334,8 +334,13 @@ They count bytes from the beginning of the body."
         (unless (cadr size-and-charset)
           ;; If the headers don't specify any particular charset, use the
           ;; usual heuristic/rules that we apply to files.
-          (decode-coding-inserted-region start (point) url visit beg end replace))
-        (list url (car size-and-charset))))))
+          (decode-coding-inserted-region start (point) url
+                                         visit beg end replace))
+        (let ((inserted (car size-and-charset)))
+          (when (fboundp 'after-insert-file-set-coding)
+            (let ((insval (after-insert-file-set-coding inserted visit)))
+              (if insval (setq inserted insval))))
+          (list url inserted))))))
 
 (put 'insert-file-contents 'url-file-handlers 'url-insert-file-contents)