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?

2
  • Does (set-default buffer-file-coding-system 'utf-8) help?
    – PythonNut
    Commented Feb 26, 2015 at 22:40
  • 2
    In reality though, something should be done about this server-side. Commented Mar 4, 2015 at 14:59

3 Answers 3

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)
1
  • Just make sure you place the form before something like (require 'package) Commented Mar 4, 2015 at 14:58
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.