> Not in detail, it's not an area of expertise of mine. We call
> (decode-coding-region (point-min) (point-max) 'undecided) on the
> payload of "https://elpa.gnu.org/packages/archive-contents",
> which is raw text. The resulting buffer's buffer-file-coding-
> system is iso-latin-1-dos.
Indeed, it seems that url-insert-file-contents sets
buffer-file-coding-system. Maybe we can use that in the emacs-26
branch. Can you try the emacs-26 code with the patch below to see if it
fixes the current problem?
Yes, it seems to. At least, there's no error from [M-x package-list-packages] in emacs -Q.