Subject: Re: 25.3; [PATCH] Change prefered coding system for Japanese language environment

From: Paul Eggert <[email-masked]>
Date: Fri, 6 Oct 2017 14:10:29 -0700

Thanks for the bug report. Would you please discuss the practical 
advantages of the proposed patch?

Is the patch is for Japanese users who do not specify a locale via 
environment variables like LC_ALL? If so, how do they specify their 
preference to Emacs now, and how would this change affect behavior for 
them? And how do users specify their coding preference to other 
programs, such as "cat" and "diff"?

I have the impression that Emacs users in Japan are gradually switching 
from EUC-JP to UTF-8. Is there some way to verify this? I know of 
website surveys like 
<https://w3techs.com/technologies/history_overview/character_encoding/ms/y>, 
which says that since 2010 UTF-8 has grown from 51% to 90% of websites 
whereas EUC-JP has shrunk from 0.7% to 0.3% worldwide. However, this 
issue is more about what encodings are used by keyboards and terminal 
displays in Japan (typically these are programs in windowing systems 
these days, as GNU/Linux consoles cannot handle enough characters to 
support Japanese). Is there some way to estimate this?

A minor point: a change like this should be noted in the NEWS file, and 
the commit message should use the usual Emacs style. I'm attaching a 
copy of your patch with a revised commit message, along with another 
patch to mention this change in NEWS and to change affected 
documentation. I will ask for comment about this proposed change on the 
emacs-devel mailing list.

>From 8484dc66eee6b78771fa3332e63ddec9d5022cd4 Mon Sep 17 00:00:00 2001
From: Yasuhiro KIMURA <[email-masked]>
Date: Fri, 6 Oct 2017 13:07:41 -0700
Subject: [PATCH 1/2] Change preferred Japanese coding system to UTF-8

* lisp/language/japan-util.el (setup-japanese-environment-internal):
Use utf-8 as preferred coding system instead of japanese-iso-8bit when
system is not MS-Windows. And while I'm at it, fix comment to fit current
implementation.  (Bug#28705)
Copyright-paperwork-exempt: yes.
---
 lisp/language/japan-util.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/language/japan-util.el b/lisp/language/japan-util.el
index 988b925409..fb4b408cd3 100644
--- a/lisp/language/japan-util.el
+++ b/lisp/language/japan-util.el
@@ -29,11 +29,11 @@
 
 ;;;###autoload
 (defun setup-japanese-environment-internal ()
-  ;; By default, we use 'japanese-iso-8bit for file names.  But, the
+  ;; By default, we use 'iso-2022-jp for default coding system.  But, the
   ;; following prefer-coding-system will override it.
   (if (memq system-type '(windows-nt ms-dos cygwin))
       (prefer-coding-system 'japanese-shift-jis)
-    (prefer-coding-system 'japanese-iso-8bit))
+    (prefer-coding-system 'utf-8))
   (use-cjk-char-width-table 'ja_JP))
 
 (defconst japanese-kana-table
-- 
2.13.6

>From fb3e73de90a7eb90ac979deca1f8bd32871bb608 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Fri, 6 Oct 2017 13:48:08 -0700
Subject: [PATCH 2/2] Mention Japanese change in documentation

---
 doc/emacs/mule.texi | 2 +-
 etc/NEWS            | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/doc/emacs/mule.texi b/doc/emacs/mule.texi
index 8a4d91f80b..d3f54f65c9 100644
--- a/doc/emacs/mule.texi
+++ b/doc/emacs/mule.texi
@@ -405,7 +405,7 @@ Language Environments
 coding system instead.  For example, if the locale @samp{ja_JP.PCK}
 matches @code{japanese-shift-jis} in
 @code{locale-preferred-coding-systems}, Emacs uses that encoding even
-though it might normally use @code{japanese-iso-8bit}.
+though it might normally use @code{utf-8}.
 
   You can override the language environment chosen at startup with
 explicit use of the command @code{set-language-environment}, or with
diff --git a/etc/NEWS b/etc/NEWS
index 15661808c7..2a1218a4a8 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -31,6 +31,10 @@ When you add a new item, use the appropriate mark if you are sure it applies,
 
 * Changes in Emacs 27.1
 
+** In Japanese environments that do not specify encodings and are not
+based on MS-Windows, the default encoding is now utf-8 instead of
+japanese-iso-8bit.
+
 +++
 ** New function 'logcount' calculates an integer's Hamming weight.
 
-- 
2.13.6