10

Upon running package-list-packages, I get the following error.

These default coding systems were tried to encode text
in the buffer ` *temp*':
  (iso-latin-1-dos (3242 . 37326) (3243 . 40165))
However, each of them encountered characters it couldn't encode:
  iso-latin-1-dos cannot encode these: 野 鳥

How can I set the default package manager encoding to be utf-8?

Matthew Piziak
  • 5,958
  • 3
  • 29
  • 77

3 Answers3

9

Depending on your preference, you can use the following line in your .emacs to set your default coding system to utf-8. That resolved the problem for me, and I haven't noticed any other negative side effects yet.

(prefer-coding-system 'utf-8)
Ryan
  • 3,989
  • 1
  • 26
  • 49
1

If you need a default encoding different from utf-8, you could use an advice around the list-package function to force use of utf-8 encoding : ex:

(defun pte/list-packages (org-fun &rest args)
  "Ensure to set `buffer-file-coding-system' to utf-8 before calling `list-packages'."
  (let ((buffer-file-coding-system 'utf-8))
    (apply org-fun args)))

(advice-add 'list-packages :around #'pte/list-packages)

In my daily use I need to use :

(prefer-coding-system 'windows-1252)

So I've advised the list-package function ... hope this could help.

0

Do you have a line like this in your init file?

(set-language-environment "Latin-1")

If so, try removing it.

Malabarba
  • 22,878
  • 6
  • 78
  • 163