Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 400585

Summary: app-editors/vim-7.3: broken unicode while copy/paste with X PRIMARY and CLIPBOARD
Product: Gentoo Linux Reporter: Alex Efros <powerman-asdf>
Component: Current packagesAssignee: Vim Maintainers <vim>
Status: RESOLVED FIXED    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: patch to add support for copy/paste utf8 to/from X PRIMARY/CLIPBOARD

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.