9

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?

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

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)
  • Just make sure you place the form before something like (require 'package) – Sean Allred Mar 4 '15 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, privacy policy and cookie policy

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