in emacs · emacs-utf-8 · utf-8

Emacs: Saving files in UTF-8

The source that gave me the solution was this one:    http://hacks.catdancer.ws/emacs-utf8.html

 

At work I cannot work with GNU/Linux like at home. But I do use emacs for my developments, combined with FTPDrive to access the remote ftp files as if they were a local folder (in the style of curlFTPfs on GNU/Linux).

When creating a file from emacs in that directory and then opening it in the browser, the accents, eñes, etc… were not displayed.

How to fix it:

  1. Type M-x customize-variable RET auto-coding-alist RET
  2. Press the first “INS” button (at the top of the page).
  3. In “File name regexp”, enter \.php\'
    (Backslash dot P H P  backslash single-quote).
  4. In “Coding system”, enter utf-8
  5. Press the “Save for Future Sessions” button.

As an alternative way of doing it you could add this to your .emacs file:

(setq auto-coding-alist (cons ’(“\.php\’” . utf-8) auto-coding-alist))

Another tip from zoperman