Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 400585 - app-editors/vim-7.3: broken unicode while copy/paste with X PRIMARY and CLIPBOARD
Summary: app-editors/vim-7.3: broken unicode while copy/paste with X PRIMARY and CLIPB...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Vim Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-24 11:30 UTC by Alex Efros
Modified: 2014-01-25 21:18 UTC (History)
0 users

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


Attachments
patch to add support for copy/paste utf8 to/from X PRIMARY/CLIPBOARD (clip-utf8.patch,2.36 KB, text/plain)
2012-01-24 11:30 UTC, Alex Efros
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Efros 2012-01-24 11:30:47 UTC
Created attachment 299725 [details]
patch to add support for copy/paste utf8 to/from X PRIMARY/CLIPBOARD

$ echo $LANG
    ru_RU.UTF-8

    $ vi -u NONE
    :call setreg('*','Hello Привет PRIMARY')

This will copy text to Xorg PRIMARY selection, but Russian will be broken.
Copying Russian between xterm, pidgin and opera works ok on my system, and
only Vim is damaging Russian both when copy and paste to pidgin and opera.

Pasting with middle button in xterm output Russian correctly.
But when I paste (using middle mouse button) this text to GUI applications
I got this:

    Pidgin: Hello  PRIMARY
    Opera: Hello $(B'1'b'Z'S'V'd.(B PRIMARY

The xsel tool output Russian correctly, but print warning:

    $ xsel -v -o -p
    xsel: Conversion refused
    Hello Привет PRIMARY

Exactly same issue apply to copying to register '+' and to paste from both
registers.

This happens because Vim doesn't support UTF8_STRING X Atom type for clipboard contents. I've create patch (attached) which add this support. It works for me (tested on vim-7.3.266 and vim-7.3.409), and was sent upstream.

To use it add into .ebuild:

    epatch "${FILESDIR}"/clip-utf8.patch
Comment 1 Tim Harder gentoo-dev 2014-01-25 21:18:43 UTC
This appears to be fixed in recent versions.