ALT Linux Bugzilla – #786
Garbled non-ASCII text in X selection pasting
Last modified: 2003-08-25 15:18:29
You need to
before you can comment on or make changes to this bug.
In the ru_RU.KOI8-R locale, select any text containing Russian characters in a
GTK+ window, then paste it in an Emacs buffer.
The result contains the original Russian strings mixed with garbage that seems
to be special control sequences.
Seeing this on:
The cause of this is probably that GNU Emacs doesn\'t treat \"extended
specified by X Compound Text (section 6 in ctext.ps from XFree86 docs). (As far
as I understand, X Compound Text is a subset of iso2022 and these
\"segments\" -- their meaning -- is an extension specified only by X;
and Emacs parses the pure iso2022 and so pays no attention to the special
meaning of these \"segments\".)
You will not see this bug, if you start a gtk+ application in ru_RU.ISO8859-5
and set-selection-coding-system to compound-text, because then there is no need
in using the \"extended segments\" to transfer Cyrillic text.
This bug is not so easy to fix well (or even understand whether it is the
described problem) if one is not an Emacs hacker. We should follow up with them
concerning this issue.
A work-around could be requesting the selection as STRING instead of
COMPOUND-TEXT that is preferred now (by signalling an error in x-get-selection
wrapper-function) and treating the result as a koi8-r encoded string (or
whatever the common encoding is). Then, of course, multilingual texts will not
be transferred correctly.
According to <a
(linked from <a
there is also a new third way to transfer selection data in addition to STRING
and COMPOUND-TEXT: UTF8-STRING. Ideally, Emacs should prefer this way,
otherwise fallback to cumbersome COMPUND-TEXT (support for its X variant should
The latest GNU release fixes the problem (!), we ought to build it.
* Changes in Emacs 21.2
** Emacs now supports ICCCM Extended Segments in X selections.
Now it works for koi8-r. Should test it in cp1251, and then will mark the bug
The worryings were justified. Emacs doesn\'t process extended segments in
miscrosoft-cp1251 or koi8-u.
Selections with extended segments in koi8-r were correctly porcessed already in
emacs-21.2-alt1. (iso8859-5 is not used in extended segments, it is a part of
the standard compound text, and so it worked.)
This bug is completly fixed in emacs-21.2-alt4 where the support for koi8-u and
microsoft-cp1251 has been added. (This wasn\'t hard: add two more entries to a
To work correctly with X selections, one should use the deafult value for
selection-coding-system: compound-text-with-extensions. Modify .emacs
accordingly. etcskel-2.0.2-alt1 conforms to this requirement. emacs-21.2-alt2
and later conflicts with earlier etcskel to allow consistent update.
(Note: some old XFree86-libs construct wrong compound text with extensions, so
this fix/feature of Emacs can not be tested on such systems, e.g. with