Subject: bug#58326: Reading unicode user inputs from minibuffer

From: Robert Pluim <[email-masked]>
Date: Thu, 06 Oct 2022 10:45:24 +0200

>>>>> On Thu, 06 Oct 2022 03:42:14 +0000, uzibalqa via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <[email-masked]> said:

    uzibalqa> I am using "read-char-by-name" to read utf8 hex codes
    uzibalqa> from user for input to "glasses-separator".  But because
    uzibalqa> "glasses-separator" requires a string I have to do
    uzibalqa> (string (read-char-by-name "hex: ")).  Meaning that
    uzibalqa> users cannot pass "\u2192", but have to use "#x2192".
    uzibalqa> Yet, using "completing-read", the list can contain
    uzibalqa> "\u2192", which works fine.  I am also unsure whether
    uzibalqa> there is an inconsistency with
    uzibalqa> display-fill-column-indicator-character which also takes
    uzibalqa> unicode.

    uzibalqa> Could the setting up of "glasses-separator" be
    uzibalqa> simplified?  Could "read-char-by-name" be extended to
    uzibalqa> accept hexcodes like "\u2192", or is there some other
    uzibalqa> function that can handle the different unicode inputs
    uzibalqa> from minibuffer better?

I suggest you read the docstring for `read-char-by-name' more
carefully:

    Accept a name like "CIRCULATION FUNCTION", a hexadecimal
    number like "2A10", or a number in hash notation (e.g.,
    "#x2a10" for hex, "10r10768" for decimal, or "#o25020" for
    octal).  Treat otherwise-ambiguous strings like "BED" (U+1F6CF)
    as names, not numbers.

Robert
--