From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#15803: default-file-name-coding-system: utf-8 better than latin-1 these days? Date: Wed, 09 Sep 2020 15:15:09 +0200 Message-ID: <87imcn9jmq.fsf@gnus.org> References: <708ten8bam.fsf@fencepost.gnu.org> <83shcu3mtf.fsf@gnu.org> <83y3mdwo0a.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14118"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 15803@debbugs.gnu.org To: Glenn Morris Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 09 15:16:13 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kFzxM-0003Xu-Oz for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 09 Sep 2020 15:16:12 +0200 Original-Received: from localhost ([::1]:58030 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFzxL-0002wz-Qg for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 09 Sep 2020 09:16:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58872) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFzxC-0002sf-Ef for bug-gnu-emacs@gnu.org; Wed, 09 Sep 2020 09:16:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46297) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kFzxC-0003d5-5J for bug-gnu-emacs@gnu.org; Wed, 09 Sep 2020 09:16:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kFzxB-0008Au-W5 for bug-gnu-emacs@gnu.org; Wed, 09 Sep 2020 09:16:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 09 Sep 2020 13:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15803 X-GNU-PR-Package: emacs Original-Received: via spool by 15803-submit@debbugs.gnu.org id=B15803.159965732429309 (code B ref 15803); Wed, 09 Sep 2020 13:16:01 +0000 Original-Received: (at 15803) by debbugs.gnu.org; 9 Sep 2020 13:15:24 +0000 Original-Received: from localhost ([127.0.0.1]:57843 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kFzwa-0007cF-6X for submit@debbugs.gnu.org; Wed, 09 Sep 2020 09:15:24 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:54058) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kFzwY-0007VB-VA for 15803@debbugs.gnu.org; Wed, 09 Sep 2020 09:15:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=qOu1frXkOoT+wReYPyMswpnwHX7lb6YKIwKhwxG57B0=; b=tXa/vw6j+nYCavUeiJ5dUgfONx JuWRq7/M0L4Avs6z3y/aNdixsW/GjcwK6AWERhonuFAk5sxgiTUtMVxd5QAFjjtGz3cJlobjiSTBJ 7EARScplKaNTkw0sfJ44musjZ72hTSUZR1Ej8WJ6IPJ1m9OeL1w1fOf9JIC3CZNGTABM=; Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kFzwN-0002su-9e; Wed, 09 Sep 2020 15:15:16 +0200 X-Now-Playing: Drew Daniel, John Wiese's _Continuous Hole_: "Intro" In-Reply-To: (Glenn Morris's message of "Mon, 11 Dec 2017 20:38:15 -0500") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:187646 Archived-At: Glenn Morris writes: > utf-8 is the sensible, "modern" (ie, non-ancient) default. > If there is no reason to use latin-1, Emacs should use utf-8. > I'm not claiming it's critical. > > Take it or leave it, as you wish. That was the final message in the thread. Glenn's patch from six years ago no longer applied, so I've respun it for Emacs 28 now (included below). Glenn's arguments make sense to me, but I'm not a domain expert here. Does anybody object to applying this patch to Emacs 28? diff --git a/doc/emacs/mule.texi b/doc/emacs/mule.texi index 6eff0ca0d2..b78019020a 100644 --- a/doc/emacs/mule.texi +++ b/doc/emacs/mule.texi @@ -1215,11 +1215,8 @@ File Name Coding If @code{file-name-coding-system} is @code{nil}, Emacs uses a default coding system determined by the selected language environment, -and stored in the @code{default-file-name-coding-system} variable. -@c FIXME? Is this correct? What is the "default language environment"? -In the default language environment, non-@acronym{ASCII} characters in -file names are not encoded specially; they appear in the file system -using the internal Emacs representation. +and stored in the @code{default-file-name-coding-system} variable +(normally UTF-8). @cindex file-name encoding, MS-Windows @vindex w32-unicode-filenames diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index ccc8ac9f9e..e3155dfc52 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -1799,13 +1799,11 @@ reset-language-environment 'raw-text) (set-default-coding-systems nil) - (setq default-sendmail-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. - ;; [Actually, it seems to work fine to use utf-8-unix here, and not just - ;; on Darwin. The previous comment seems to be outdated? - ;; See patch at https://debbugs.gnu.org/15803 ] - (setq default-file-name-coding-system 'iso-latin-1-unix) + (setq default-sendmail-coding-system 'utf-8) + (setq default-file-name-coding-system (if (memq system-type + '(window-nt ms-dos)) + 'iso-latin-1-unix + 'utf-8-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 @@ -1821,8 +1819,10 @@ reset-language-environment (input-coding (condition-case nil (coding-system-change-text-conversion - (cdr default-process-coding-system) 'iso-latin-1) - (coding-system-error 'iso-latin-1)))) + (cdr default-process-coding-system) + (if (memq system-type '(window-nt ms-dos)) 'iso-latin-1 'utf-8)) + (coding-system-error + (if (memq system-type '(window-nt ms-dos)) 'iso-latin-1 'utf-8))))) (setq default-process-coding-system (cons output-coding input-coding))) diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el index dd6eecbfd0..7610939e57 100644 --- a/lisp/mail/sendmail.el +++ b/lisp/mail/sendmail.el @@ -975,7 +975,7 @@ sendmail-coding-system See also the function `select-message-coding-system'.") ;;;###autoload -(defvar default-sendmail-coding-system 'iso-latin-1 +(defvar default-sendmail-coding-system 'utf-8 "Default coding system for encoding the outgoing mail. This variable is used only when `sendmail-coding-system' is nil. diff --git a/lisp/mh-e/mh-comp.el b/lisp/mh-e/mh-comp.el index f7e30bfbb3..8a69adbb75 100644 --- a/lisp/mh-e/mh-comp.el +++ b/lisp/mh-e/mh-comp.el @@ -305,6 +305,7 @@ mh-send-letter (let ((draft-buffer (current-buffer)) (file-name buffer-file-name) (config mh-previous-window-config) + ;; FIXME this is subtly different to select-message-coding-system. (coding-system-for-write (if (fboundp 'select-message-coding-system) (select-message-coding-system) ; Emacs has this since at least 21.1 @@ -318,7 +319,7 @@ mh-send-letter (or (and (boundp 'sendmail-coding-system) sendmail-coding-system) (and (default-boundp 'buffer-file-coding-system) (default-value 'buffer-file-coding-system)) - 'iso-latin-1))))) + 'utf-8))))) ;; Older versions of spost do not support -msgid and -mime. (unless mh-send-uses-spost-flag ;; Adding a Message-ID field looks good, makes it easier to search for -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no