From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: on eshell's encoding Date: Tue, 26 Jul 2016 20:17:06 +0300 Message-ID: <83twfcs4j1.fsf@gnu.org> References: <86fuqw5vd8.fsf@toledo.com> <864m7c5oqc.fsf@toledo.com> NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1469553481 29030 80.91.229.3 (26 Jul 2016 17:18:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 26 Jul 2016 17:18:01 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jul 26 19:17:56 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bS5zP-0003b8-NB for geh-help-gnu-emacs@m.gmane.org; Tue, 26 Jul 2016 19:17:55 +0200 Original-Received: from localhost ([::1]:41362 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bS5zO-0007yy-Qk for geh-help-gnu-emacs@m.gmane.org; Tue, 26 Jul 2016 13:17:54 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52686) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bS5ys-0007yr-Sq for help-gnu-emacs@gnu.org; Tue, 26 Jul 2016 13:17:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bS5yo-0006oV-MC for help-gnu-emacs@gnu.org; Tue, 26 Jul 2016 13:17:21 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:42922) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bS5yo-0006oK-IY for help-gnu-emacs@gnu.org; Tue, 26 Jul 2016 13:17:18 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2527 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bS5yn-0003ME-6N for help-gnu-emacs@gnu.org; Tue, 26 Jul 2016 13:17:17 -0400 In-reply-to: <864m7c5oqc.fsf@toledo.com> (message from Daniel Bastos on Tue, 26 Jul 2016 13:49:15 -0300) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:110940 Archived-At: > From: Daniel Bastos > Date: Tue, 26 Jul 2016 13:49:15 -0300 > > > Is this on MS-Windows? If so, you cannot invoke programs from Emacs > > with command-line arguments encoded in anything but the system > > codepage. And UTF-8 cannot be a system codepage on Windows. > > You're right. This is MS-Windows. But I thought MS-Windows would not > interfere here. Why does it interfere? I thought the messages would go > straight into git's ARGV. How can it go "straight"? Eshell is not a real shell, it's a Lisp program that pretends to be a shell. When you type RET at the end of a command line, Eshell takes the command and calls a Windows API that invokes programs, passing it the command you typed. But the API that Emacs calls accepts strings encoded in the system codepage. So the UTF-8 string you typed is interpreted as encoded in that codepage, and that's why you get it back garbled. If the characters you typed can be encoded by your system codepage, then what you do should still work, if you tell Git that log messages are encoded in that codepage. Read about the i18n.commitEncoding configuration parameter in the Git documentation. However, I don't recommend doing that, because you (and whoever else participates in that project) will have then confine yourself to that encoding. There's no way of safely passing UTF-8 encoded command-line arguments to a Windows program. The only way to break the limitations of the system codepage is to use the Unicode (a.k.a. "wide") APIs, which expect strings in UTF-16 encoding. But that is not currently supported in Emacs, due to boring technical problems. > > I suggest to put the commit message in a file and use the -F switch to > > "git commit". Or use the built-in VC commands, they will do this > > automatically for you (if you have Emacs 25). > > If I put the commit message in a file, even without using -F switch, it > works as expected. It will always work from a file, because file I/O doesn't have this limitation.