Thursday, November 30, 2017

Re: xterm(1) changing UTF-8 characters when copy-pasting?

Anthony J. Bentley wrote:
>I get the same result, but only when using TrueType fonts (default or no).

If I use TrueType fonts:

$ printf "e\xcc\x81\n"

only shows the letter 'e', and when I try to copy-paste it I get a letter
'e' followed by a question mark inside a circle. If I then redraw the line
I get an 'e' by itself but od(1) shows that it is still e\xcc\x81.

Using TrueType fonts:

$ printf "\xc3\xa9\n"

works fine and I can copy-paste the accented 'e' without problem.

========

Without TrueType fonts:

$ printf "e\xcc\x81\n"

works fine but when I try to copy-paste the accented 'e' I get a letter 'e'
followed by a question mark inside a circle. If I then redraw the line I
get the correct accented 'e' again (which od(1) shows is still e\xcc\x81).

Without TrueType fonts:

$ printf "\xc3\xa9\n"

works fine and I can copy-paste the accented 'e' without problem.

========

So there seems to be two problems:

- Copy-pasting the result of printf "e\xcc\x81\n" never works correctly in
xterm, regardless of whether I use TrueType fonts or not. xterm
copy-pastes the correct sequence of bytes but that sequence is not
displayed correctly. That's the same problem I noticed in my previous
email.

- When using TrueType fonts, printf "e\xcc\x81\n" does not show the accent.

On a note related to this second problem, I never use TrueType fonts in
xterm anyway because then xterm can't display Thai or Chinese or Korean
characters (at least with the default font; I haven't tried to use any
other font). So I suspect that this second problem is more a font problem
than an xterm bug.

Here's my current config:

$ xrdb -query
xterm*background: black
xterm*foreground: white
xterm*metaSendsEscape: true
xterm*multiScroll: true
xterm*precompose: false
xterm*saveLines: 256
xterm*scrollBar: true
xterm*scrollKey: true
xterm*scrollTtyOutput: false
xterm*utf8Title: true
xterm*utmpInhibit: true
xterm*visualBell: true

and:

$ set | egrep -i utf
LC_CTYPE=en_US.UTF-8
XTERM_LOCALE=en_US.UTF-8

Philippe

No comments:

Post a Comment