Subject: Re: bug#52179: Highlighting a word in `ispell' using `enchant'

From: Tor Kringeland <[email-masked]>
Date: Mon, 29 Nov 2021 21:46:05 +0100

Eli Zaretskii <[email-masked]> writes:

>> From: Tor Kringeland <[email-masked]>
>> Date: Mon, 29 Nov 2021 15:44:39 +0100
>> 
>> Using `ispell' with `enchant' on macOS yields the following problem.  If
>> a word contains some non-ASCII character, said character will not be
>> considered part of the word and will split it (like a digit would).  For
>> example in "naïve" both "na" and "ve" are considered two words.  This
>> does not happen if I use `aspell' instead of `enchant', and if I run
>> 
>>   echo -n "naïve" | enchant-2 -a
>> 
>> it registers that this is one word, and that it is valid (using an
>> English dictionary).
>> 
>> I'm using Enchant version 2.3.1 and an Emacs 29 build from 24 November
>> on macOS Catalina.
>
> Which dictionary do you use, and what encoding does that dictionary
> require?

In Emacs, the relevant entry in `ispell-dictionary-alist' is

  ("en" "[[:alpha:]]" "[^[:alpha:]]" "" t nil nil utf-8)

I installed `aspell' and `enchant' from Homebrew.  The installation of
`aspell' included a bunch of dictionaries downloaded from gnu.org.  In
particular, the "en" dictionary is downloaded from [1].  It is in some
kind of binary format after installation (see [2] for details).

The weird part is that it works fine in a command line, and switching
`ispell-program-name' to use `aspell' fixes the issue, so the problem
seems to be somehow in how Emacs interacts with the `enchant-2' binary.
It's doing the same for non-ASCII characters as one would expect from
numbers: the string "one0two" is valid, as "one" and "two" are treated
as separate words and "0" is ignored.

- [1] https://ftp.gnu.org/gnu/aspell/dict/en/aspell6-en-2018.04.16-0.tar.bz2

- [2] https://github.com/Homebrew/homebrew-core/blob/master/Formula/aspell.rb