[Top][All Lists]

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

Re: char-displayable-p returns t for undisplayable characters

From: Kenichi Handa
Subject: Re: char-displayable-p returns t for undisplayable characters
Date: Mon, 9 Feb 2004 16:55:46 +0900 (JST)
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.3 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI)

In article <address@hidden>, Jonathan Yavner <address@hidden> writes:
> Using "emacs -nw" inside xterm under RedHat 8.0

> For utf8 locale, the character '…' (ellipsis) displays as a blank.  A call to
> (char-displayable-p ?…) returns t, but this character is not displayable.  The
> character 'é' (e-acute) displays properly.

When you run emacs with -nw, the only way for emacs to know
if a specific character is displayable or not is to check
the terminal-coding-system.  If the character is encodable
by the coding system, Emacs decides that the character is
displayable.  And, in utf-8 locale, I think your
terminal-coding-system is utf-8, thus Emacs desides that '…'
is displayable.

> For iso88591 and iso885915 locales, 'é' (e-acute) displays as a blank while
> '…' (ellipsis) displays reasonably as a question mark.  In this case,
> char-displayable-p returns t for the e-acute that displays a blank, but
> returns nil for the ellipsis that displays as a question mark.

> Note: xterm in locale iso88591 *can* display an e-acute, but not when running
> Emacs.  Why?

That is strange.  Please save the following code in file

(defun test-e-acute ()
  (switch-to-buffer "temp")
  (insert (format "e-acute(%c)\n" (decode-char 'ucs #xe9)))
  (open-termscript "e-acute")
  (sit-for 0)

and do this:
% emacs -nw -l temp.el --eval '(test-e-acute)'

It will write out a file "e-acute" which contains all bytes
Emacs sent to your terminal.

% LANG=C od -c e-acute | more

will tell you exactly what byte was sent for e-acute.  In my
environment, it shows this:

0000000 033   [   H 033   [   2   J 033   [   2   4   ;   1   H   F   o
0000020   r       i   n   f   o   r   m   a   t   i   o   n       a   b
0000040   o   u   t       t   h   e       G   N   U       P   r   o   j
0000060   e   c   t       a   n   d       i   t   s       g   o   a   l
0000100   s   ,       t   y   p   e       C   -   h       C   -   p   .
0000120 033   [   K 033   [   H   e   -   a   c   u   t   e   ( 351   )
0000140 033   [   K  \r  \n 033   [   K  \n 033   [   K  \n 033   [   K

"351" between '(' and ')' means that the byte \351 (0xE9) is
sent to a terminal, which is the correct byte for e-acute in

> Under X11, the e-acute and ellipsis characters both display properly in 
> Emacs, 
> while '√' (square root) displays as a white rectangle.  char-displayable-p 
> returns non-nil for the square-root character, and other programs on my 
> computer (such as kmail) can display that character.

Please tell me the result of the followings:

(fontset-font (frame-parameter nil 'font) ?√)
(fontset-font "fontset-default" ?√)

And please type C-u C-x = while putting cursor on √.

> I had planned to use char-displayable-p to decide whether
> an ellipsis can be displayed for a truncated field, with
> fallback to a dollar sign if not.  Is there any way to
> tell whether a character is actually displayable, rather
> than whether the current locale has a slot for it?

Unfortunately, there's no way for the moment.

Ken'ichi HANDA

reply via email to

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