[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Nextstep build uses iso-latin by default. WHY?

From: Alan Third
Subject: Re: Nextstep build uses iso-latin by default. WHY?
Date: Sun, 20 Mar 2016 15:11:23 +0000
User-agent: Mutt/1.5.24 (2015-08-30)

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)
+      /* 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:@"address@hidden",
+                                     [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 via email to

[Prev in Thread] Current Thread [Next in Thread]