@code{gnus-group-name-charset-group-alist}.
If @code{default-file-name-coding-system} or this variable is
-initialized by default to @code{iso-latin-1} for example, although you
+initialized by default to @code{iso-latin-1-unix} for example, although you
want to subscribe to the groups spelled in Chinese, that is the most
typical case where you have to customize
-@code{nnmail-pathname-coding-system}. The @code{utf-8} coding system is
+@code{nnmail-pathname-coding-system}. The @code{utf-8-unix} coding system is
a good candidate for it. Otherwise, you may change the locale in your
system so that @code{default-file-name-coding-system} or this variable
may be initialized to an appropriate value.
accepts Lisp symbols which begin with the following quotation
characters: ‘’‛“”‟〞"', unless they are escaped with backslash.
++++
+** 'default-file-name-coding-system' now defaults to a coding system
+that does not process CRLF. For example, it defaults to utf-8-unix
+instead of to utf-8. Before this change, Emacs would sometimes
+mishandle file names containing these control characters.
+
+++
** Module functions are now implemented slightly differently; in
particular, the function 'internal--module-call' has been removed.
(if (eq system-type 'darwin)
;; The file-name coding system on Darwin systems is always utf-8.
- (setq default-file-name-coding-system 'utf-8)
+ (setq default-file-name-coding-system 'utf-8-unix)
(if (and (default-value 'enable-multibyte-characters)
(or (not coding-system)
(coding-system-get coding-system 'ascii-compatible-p)))
- (setq default-file-name-coding-system coding-system)))
+ (setq default-file-name-coding-system
+ (coding-system-change-eol-conversion coding-system 'unix))))
(setq default-terminal-coding-system coding-system)
;; Prevent default-terminal-coding-system from converting ^M to ^J.
(setq default-keyboard-coding-system
(coding-system-change-eol-conversion base eol-type)))
(set-default-coding-systems base)
(if (called-interactively-p 'interactive)
- (or (eq base default-file-name-coding-system)
+ (or (eq base (coding-system-type default-file-name-coding-system))
(message "The default value of `file-name-coding-system' was not changed because the specified coding system is not suitable for file names.")))))
(defvar sort-coding-systems-predicate nil
(set-default-coding-systems nil)
(setq default-sendmail-coding-system 'iso-latin-1)
- ;; On Darwin systems, this should be utf-8, but when this file is loaded
- ;; utf-8 is not yet defined, so we set it in set-locale-environment instead.
- (setq default-file-name-coding-system 'iso-latin-1)
+ ;; On Darwin systems, this should be utf-8-unix, but when this file is loaded
+ ;; that is not yet defined, so we set it in set-locale-environment instead.
+ (setq default-file-name-coding-system 'iso-latin-1-unix)
;; Preserve eol-type from existing default-process-coding-systems.
;; On non-unix-like systems in particular, these may have been set
;; carefully by the user, or by the startup code, to deal with the
(when (eq system-type 'darwin)
;; On Darwin, file names are always encoded in utf-8, no matter
;; the locale.
- (setq default-file-name-coding-system 'utf-8)
+ (setq default-file-name-coding-system 'utf-8-unix)
;; macOS's Terminal.app by default uses utf-8 regardless of
;; the locale.
(when (and (null window-system)
'utf-8-hfs 'utf-8))
(coding-system-for-read utf8)
(coding-system-for-write utf8)
- (file-name-coding-system utf8))
+ (file-name-coding-system
+ (coding-system-change-eol-conversion utf8 'unix)))
(tramp--test-check-files
(unless (tramp--test-hpux-p) "Γυρίστε το Γαλαξία με Ώτο Στοπ")
(unless (tramp--test-hpux-p)
--- /dev/null
+;;; unit tests for src/fileio.c -*- lexical-binding: t; -*-
+
+;; Copyright 2017 Free Software Foundation, Inc.
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+
+(require 'ert)
+
+(defun try-char (char link)
+ (let ((target (string char)))
+ (make-symbolic-link target link)
+ (let* ((read-link (file-symlink-p link))
+ (failure (unless (string-equal target read-link)
+ (list 'string-equal target read-link))))
+ (delete-file link)
+ failure)))
+
+(defun fileio-tests--symlink-failure ()
+ (let* ((dir (make-temp-file "fileio" t))
+ (link (expand-file-name "link" dir)))
+ (unwind-protect
+ (let ((failure
+ (let ((default-file-name-coding-system 'utf-8-unix))
+ (try-char (unibyte-char-to-multibyte 128) link)))
+ (char 0))
+ (while (and (not failure) (< char 300))
+ (setq char (1+ char))
+ (unless (= char ?~)
+ (setq failure (try-char char link))))
+ failure)
+ (delete-directory dir t))))
+
+(ert-deftest fileio-tests--odd-symlink-chars ()
+ "Check that any non-NULL ASCII character can appear in a symlink.
+Also check that an encoding error can appear in a symlink."
+ (should (equal nil (fileio-tests--symlink-failure))))