views:

129

answers:

2

I am a newbie in Emacs, and I am not a programmer. I have just tried to save a simple *.rtf file with some websites and tips on how to use emacs and I got

These default coding systems were tried to encode text in the buffer `notes.rtf': (iso-latin-1-dos (315 . 8216) (338 . 8217) (1514 . 8220) (1525 . 8221)) However, each of them encountered characters it couldn't encode: iso-latin-1-dos cannot encode these: ‘ ’ “ ”
....
etc, etc, etc

Now what is that? Now it is asking me to chose an encoding system

Select coding system (default chinese-iso-8bit):

I don't even know what an encoding system is, and I would rather not have to choose one every time I try and save a document... Is there any way I can set an encoding system that will work with all my files so I don't have to worry about this?

I saw another question and asnswer elsewhere in this website (see it here) and it seems that if I type the following

(defun set-coding-system () (setq buffer-file-coding-system 'utf-8-unix)) (add-hook 'find-file-hook 'set-coding-system)

then I can have Emacs do this, but I am not sure... Can someone confirm this to me?

Thanks so much :)

+3  A: 

You should use UTF8; it can handle all the characters you'll ever need

SLaks
So if I put(defun set-coding-system () (setq buffer-file-coding-system 'utf-8-unix)) (add-hook 'find-file-hook 'set-coding-system)in my .emacs file will my problem be solved?Thanks!
Vivi
I can't even set the coding system now. When I try to answer the question about the coding system it says: "text is read only" :( I have never felt so computer illiterate as now.
Vivi
OK, I found a good answer: Q: "How to permanently choose a encoding system in emacs for opening and saving?" ->A: "Choose the menu “Options‣Mule (Multilingual Environment)‣Set Language Environment”. After that, be sure to pull the menu “Options‣Save Options” to save the setting in your emacs init file."Yay! Thanks
Vivi
+4  A: 

Here's a pretty comprehensive group of magic invocations to make Emacs use UTF-8 everywhere by default:

  (setq utf-translate-cjk-mode nil) ; disable CJK coding/encoding (Chinese/Japanese/Korean characters)
  (set-language-environment 'utf-8)
  (set-keyboard-coding-system 'utf-8-mac) ; For old Carbon emacs on OS X only
  (setq locale-coding-system 'utf-8)
  (set-default-coding-systems 'utf-8)
  (set-terminal-coding-system 'utf-8)
  (set-selection-coding-system 'utf-8)
  (prefer-coding-system 'utf-8)
sanityinc
Thank you for that :) I really appreciate it!!!
Vivi