Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 518800 - app-portage/eix-0.29.3 prints Unicode characters in screen title
Summary: app-portage/eix-0.29.3 prints Unicode characters in screen title
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Third-Party Tools (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Martin Väth
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-02 09:37 UTC by Alex Efros
Modified: 2015-11-08 11:55 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
screenrc (screenrc,11.28 KB, text/plain)
2014-08-05 07:00 UTC, Martin Väth
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Efros 2014-08-02 09:37:58 UTC
eix-sync change window title several times while running. That title looks ok in urxvt, but when eix-sync is started inside screen with non-English locate screen's title contain something like "eix-sync: !8=E@>=870F8O 2A5E >25@;552".

Adding "defutf8 on" into .screenrc or starting screen with -U option won't help.

Moreover, according to resolution of bug 208695 eix probably shouldn't change screen's window title at all.
Comment 1 Martin Väth 2014-08-04 18:58:35 UTC
Here, utf8 is displayed properly with screen and tmux.

However, I remember that I had played quite a while with screen to configure it properly (incl. defencoding, defgr, termcapinfo OP and termcapinfo LP:G0).

In my current (working) configuration, everything except "defutf8 on" is commented out, and I am not starting screen with -U.
So I can only guess what is different to your configuration.
Maybe you have to set the locale-variables to something utf8-aware before starting screen or before starting the terminal running screen?

In any case, there is no way to check whether utf8 is understood, and utf8 is the only available encryption of translated messsages in eix.

Thus, I see no way to fix eix. The only way to "fix" it if you cannot get screen working with the output is to switch off the feature by setting TERM_STATUSLINE correspondingly (see eix --dump).

I strongly want to avoid to switch off the feature by default, since otherwise 99% of the users will not even know that this feature exists (and probably works for them).

If you want to avoid that screen changes the window title (but keeps the change of the hardstatus line), set
TERM_SOFTSTATUSLINE=""
I will not go into the political discussion whether the window title should be used by programs or kept constant forever - it depends on how people use "screen"; it is configurable in eix, and each default choice will dissatisfy some people.

(Maybe the variable name TERM_SOFTSTATUSLINE is not appropriate - obviously, it was meant as a contrast to the "hardstatus line", but for historical reasons, I think that I will not change this name anymore.)
Comment 2 Alex Efros 2014-08-05 02:20:55 UTC
(In reply to Martin Väth from comment #1)
> Here, utf8 is displayed properly with screen and tmux.

Can you please attach your /etc/screenrc and ~/.screenrc, and show your USE-flags for screen?
Comment 3 Martin Väth 2014-08-05 07:00:47 UTC
Created attachment 382306 [details]
screenrc

I have screen-4.0.3-r6 installed, all 5 USE-flags being disabled.
Comment 4 Alex Efros 2014-08-05 11:03:30 UTC
(In reply to Martin Väth from comment #3)
> Created attachment 382306 [details]
> screenrc
> 
> I have screen-4.0.3-r6 installed, all 5 USE-flags being disabled.

Thanks, but it doesn't help - using your /etc/screenrc, no /root/.screenrc and same USE-flags I still have same junk in title.

What else can affect this?
Maybe some env variables? Can you please attach output or `env` command?
Maybe `locale` output too?
Comment 5 Martin Väth 2014-08-05 13:53:09 UTC
$ locale

LANG=C
LC_CTYPE=de_DE.UTF-8
LC_NUMERIC=C
LC_TIME=de_DE.UTF-8
LC_COLLATE=C
LC_MONETARY=C
LC_MESSAGES="C"
LC_PAPER=de_DE.UTF-8
LC_NAME=de_DE.UTF-8
LC_ADDRESS=de_DE.UTF-8
LC_TELEPHONE=de_DE.UTF-8
LC_MEASUREMENT=de_DE.UTF-8
LC_IDENTIFICATION=de_DE.UTF-8
LC_ALL=

I guess it is important that the locale's are set *before* you call screen.
Comment 6 Alex Efros 2014-08-05 23:36:31 UTC
(In reply to Martin Väth from comment #5)
> LANG=C
> LC_MESSAGES="C"

Well, looks like you didn't use UTF-8 for messages at all, and your eix output text (including screen title) in English.
Comment 7 Martin Väth 2014-08-06 05:41:51 UTC
(In reply to Alex Efros from comment #6)
> Well, looks like you didn't use UTF-8 for messages at all, and your eix
> output text (including screen title) in English.

Of course, I would not sync just to see a message output.
I have tested by inserting

StatusInfo "äöüÄÖÜߧ"
sleep 5
exit

into eix-sync (after ReadFunctions), verifying that the encoding used is really UTF-8. (The latter was also confirmed that when I started screen with wrong locale, I saw roughly 16 "?" characters).
Comment 8 Alex Efros 2014-08-06 06:55:28 UTC
(In reply to Martin Väth from comment #7)
> StatusInfo "äöüÄÖÜߧ"

This works for me too. But not this:
  StatusInfo "äöüÄÖÜߧ Привет"
Maybe it's because codes of your symbols are all <255 (but they encoded using 2 bytes in UTF-8).
Comment 9 Martin Väth 2014-08-06 09:04:34 UTC
(In reply to Alex Efros from comment #8)
>   StatusInfo "äöüÄÖÜߧ Привет"

This is very strange:

1. If I run this within xterm (without screen or tmux), if the Russian "hello" is added, then suddenly also the German Umlauts break in the display (in the sense that each Umlaut becomes two symbols). If I omit the Russian part, the German Umlauts display correctly.
This leads to the conjecture that perhaps the utf8 library which xterm uses to display the title is broken.

2. If I run 1. with tmux inside xterm, xterm behaves as before, but the hardstatusline of tmux displays everything correctly.
This seems to confirm the conjecture of 1.

3. If I run 1. with screen inside xterm, xterm displays äöüÄÖÜߧ @825B
This might be "correct", because it might be that the font I am using to display the title has no Russian characters (as you might guess, I do not have much need for Russian on my system); at least, each symbol is only mapped to one symbol.
I have no idea why screen avoids the problem of "plain" xterm.

In any case, I do not know what to do:
It does not seem reasonable to mix languages in eix just because some terminal settings *might* be broken (moreover, with German characters, everything seems to work in all cases).

So I have only some (poor) suggestions:
You can use e.g. the line !!export LC_ALL=POSIX in /etc/eix-sync.conf to switch to english for eix-sync, or, as suggested earlier, you can switch off hardstatus/title settings completely.
Comment 10 Alex Efros 2014-08-06 09:34:24 UTC
(In reply to Martin Väth from comment #9)
> 3. If I run 1. with screen inside xterm, xterm displays äöüÄÖÜߧ @825B
> This might be "correct", because it might be that the font I am using to
> display the title has no Russian characters (as you might guess, I do not

No, it's not because of font:
a) if it was font then you should see empty box instead of symbol
b) I have Russian font as you may guess, but I'm also see @825B-like things
Comment 11 Martin Väth 2014-08-06 19:53:37 UTC
(In reply to Alex Efros from comment #10)
> No, it's not because of font:
> a) if it was font then you should see empty box instead of symbol
> b) I have Russian font as you may guess, but I'm also see @825B-like things

This is mysterious: I guessed first that screen is trying to do some conversion on its own, but this can also not be the case since "xterm" itself understands the UTF-8 German Umlauts.

The only explanation that I see is that the xterm utf8 library has one bug (as shown by 1. and 2.) and, whatever screen does instead of passing utf8 unchanged, is buggy, too. I admit that this does not sound very likely, but I see no other explanation for the behaviour at all...
Comment 12 Martin Väth 2015-11-08 11:55:19 UTC
The freshly released eix-0.31.3 gained the ability to make context-dependent translations for shell scripts.

This is used to avoid unicode in German translations of statusline texts.

For Russian translations, the only reasonable solution to this bug seems to be to keep the English texts in statusline texts which is the solution chosen in eix-0.31.3

Better suggestions for future eix releases are welcome.

A possible "solution" might be the usage of some transcription of Russian translations into ASCII, though I have no idea whether this is accepted in Russia. If you think it is and you are interested, update the translations with msgctxt containing "Statusline" in ru.po correspondingly and send me the patches (by github or pm).