[Top][All Lists]

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

speechd-el bug report: raw 8-bit characters

From: Nicolas Graner
Subject: speechd-el bug report: raw 8-bit characters
Date: Thu, 02 Jul 2020 18:03:49 +0200

Hi Milan and others,

when a chunk of text in emacs contains a raw 8-bit character, in some
cases the text is not spoken.


8-bit characters are handled specially in function speechd--send-text
(in file speechd.el) by these three lines:

            (if (memq (char-charset char)
                      '(eight-bit-control eight-bit-graphic))
                (setq text (replace-match (format "\\%o" char) t t text))

However, the function char-charset is not deterministic. It returns one
of the charsets that contain char, depending on charset priorities. In
my installation, it turns out that charset eight-bit has a higher priority
than eight-bit-control and eight-bit-graphic. As a result, char-charset
always returns eight-bit for 8-bit characters, the above test fails and
the characters are not handled properly.


One solution would be to add eight-bit to the list
(eight-bit-control eight-bit-graphic) but this would not be robust. It
is possible that in another installation yet another charset would have
higher priority.

A better solution is to use the second argument to char-charset, a list
of charsets to test for, which in effect makes the function
deterministic. The memq test is replaced with:

          (if (char-charset char '(eight-bit))

Related improvement:

When an 8-bit character is identified, it is replaced with its octal
value as a string. But the printed value is that of emacs's internal
representation of the character, a large number in the range 17777600 to
17777777 which is not very helpful, especially when spoken out. I
suggest to use instead the "encoded" value of the character, i.e. its
natural value in the range 200 to 377 octal, which sounds much more
familiar and consistent with the way emacs displays it. This is done by
replacing char with (encode-char char 'eight-bit))


A patch that implements bot the bug fix and the suggested improvement is

Hope this helps,


Attachment: patch
Description: Binary data

reply via email to

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