Subject: Re: bug#4157: 23.1.50; faulty character characterisation for ä

From: Stefan Kangas <[email-masked]>
Date: Thu, 10 Oct 2019 02:10:10 +0200

Stefan Monnier <[email-masked]> writes:

> >> So my guess was right: ls's output uses utf-8 for the filenames, but
> >> latin-1 for the date, which is why it's difficult for dired to do the
> >> right thing (it's not impossible, of course, but it's more work and
> >> dired is currently not setup for that).
> >
> > Ten years later, I can verify that this is still an issue on current
> > master running on macOS 10.13.  I think Stefan Monnier is spot on
> > above.
>
> I understand why utf--8 is used for the filenames, but what makes the
> month be output in latin-1?  macOS is supposedly an "all utf-8"
> environment, AFAIK.
>
> I'm not sure if macOS uses locales in the POSIX way, but... can you
> check what is your locale set to (and ideally, maybe, check what/who
> sets it)?

I've never tried changing from UTF-8 myself, and use the default
English language macOS system setting.  My default environment is
simply:

$ env | grep ^L[CA]
LC_CTYPE=UTF-8

To see this, I was running:

LC_CTYPE=de_DE.ISO8859-15 LANG=de_DE.ISO8859-15 ./src/emacs -Q

When I replace "./src/emacs -Q" with "ls -l" in terminal, I get
strange characters for files with mtime in March.  (I tried this with
the default Terminal.app as well as another terminal emulator called
iterm2.)  The month name is "März" in German but when it's in the
date, the character "ä" shows up as "?".  Meanwhile, any filenames
with the same character displays correctly, like so:

-rw-r--r--    1 skangas  staff      0 10 Okt 01:59 März
drwxr-xr-x    3 skangas  staff     96 10 M?r  2017 foobar

I see no problems displaying "ä" when I run:

LC_CTYPE=de_DE.UTF-8 LANG=de_DE.UTF-8 ./src/emacs -Q

Perhaps you're just not supposed to use anything but UTF-8 on macOS?
And this is just a configuration error?

Best regards,
Stefan Kangas