From: Alan Third Date: Fri, 8 Apr 2016 13:52:55 +0000 (+0200) Subject: Set locale encoding to UTF-8 when run from OS X GUI. X-Git-Tag: emacs-25.0.93~56^2 X-Git-Url: https://code.delx.au/gnu-emacs/commitdiff_plain/f6497c6e760b3b50015f35d7ce5a36df628ee498 Set locale encoding to UTF-8 when run from OS X GUI. * src/nsterm.m (ns_init_locale): Append .UTF-8 when setting LANG. --- diff --git a/src/nsterm.m b/src/nsterm.m index 4048ac4654..34c5395b63 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) {