all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Nextstep build uses iso-latin by default. WHY?
Date: Sun, 20 Mar 2016 15:11:23 +0000	[thread overview]
Message-ID: <20160320151123.GA65516@galloway.idiocy.org> (raw)
In-Reply-To: <jwvh9gcej03.fsf-monnier+gmane.emacs.devel@gnu.org>

On Fri, Mar 11, 2016 at 05:41:11PM -0500, Stefan Monnier wrote:
> > If you only want to have the files' default encoding be UTF-8, add
> > this to your ~/.emacs:
> >   (setq-default buffer-file-coding-system 'utf-8)
> 
> The OSX environment has always had a very strong bias towards utf-8, so
> in the absence of a strong indication that something else than utf-8 is
> desired, we should always use utf-8 on that platform.

I asked a question about this before the changes were made, but nobody
seemed to know the answer. I guess you maybe just missed the thread.

Forcing Emacs to use UTF-8 would be trivial, we're currently pulling
the locale value from the OS, and as far as I can tell it's always
returned as something like "en_GB" rather than "en_GB.UTF-8". We can
just append ".UTF-8" to the string before running setenv.

My biggest concern about that is that I don't know if there are
situations where [NSLocale localeIdentifier] will return ".UTF-8" or
something else.

Here's a patch to force UTF-8:

src/nsterm.m (ns_init_locale): Append .UTF-8 to locale string.
---
 src/nsterm.m | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/nsterm.m b/src/nsterm.m
index b796193..afb3357 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -596,8 +596,15 @@ ns_init_locale (void)
 
   @try
     {
+      /* It seems OS X should probably use UTF-8 everywhere.
+         'localeIdentifier' does not specify the encoding, and I can't
+         find any way to get the OS to tell us which encoding to use,
+         so hard-code '.UTF-8'. */
+      NSString *localeID = [NSString stringWithFormat:@"%@.UTF-8",
+                                     [locale localeIdentifier]];
+
       /* Set LANG to locale, but not if LANG is already set. */
-      setenv("LANG", [[locale localeIdentifier] UTF8String], 0);
+      setenv("LANG", [localeID UTF8String], 0);
     }
   @catch (NSException *e)
     {
-- 
Alan Third



  reply	other threads:[~2016-03-20 15:11 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-11 20:27 Nextstep build uses iso-latin by default. WHY? Angelo Graziosi
2016-03-11 20:49 ` Eli Zaretskii
2016-03-11 22:18   ` Angelo Graziosi
2016-03-12  6:54     ` Eli Zaretskii
2016-03-12 16:55       ` Angelo Graziosi
2016-03-11 22:41   ` Stefan Monnier
2016-03-20 15:11     ` Alan Third [this message]
2016-03-20 15:34       ` Stefan Monnier
2016-04-02 15:45       ` Alan Third
2016-04-08 13:57         ` Anders Lindgren
2016-04-08 14:41           ` Toon Claes
2016-04-08 19:59             ` Anders Lindgren
2016-04-08 23:03               ` John Wiegley
2016-04-14  6:30               ` Toon Claes
2016-04-14  9:31                 ` Anders Lindgren
2016-04-14 12:52                   ` Regexp search in debbugs (was: Nextstep build uses iso-latin by default. WHY?) Michael Albinus
2016-04-14 13:35                     ` Regexp search in debbugs Lars Magne Ingebrigtsen
2016-04-15  0:48                   ` Nextstep build uses iso-latin by default. WHY? YAMAMOTO Mitsuharu
2016-04-16  8:31                   ` YAMAMOTO Mitsuharu
2016-04-16 13:47                     ` Stefan Monnier
2016-04-16 22:32                       ` John Wiegley
2016-04-14 12:35                 ` Stefan Monnier
2016-04-14 16:39                   ` John Wiegley
2016-04-14 22:40                   ` YAMAMOTO Mitsuharu
2016-04-14 23:26                     ` Stefan Monnier
2016-04-15  5:42                       ` Anders Lindgren
2016-04-15  9:21                       ` YAMAMOTO Mitsuharu
2016-03-11 23:43   ` Angelo Graziosi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160320151123.GA65516@galloway.idiocy.org \
    --to=alan@idiocy.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.