--- src/ui.c.orig 2012-01-24 12:35:51.000000000 +0200 +++ src/ui.c 2012-01-24 12:35:58.000000000 +0200 @@ -1920,6 +1920,7 @@ #endif static Atom compound_text_atom; static Atom text_atom; +static Atom utf8_atom; static Atom targets_atom; static Atom timestamp_atom; /* Used to get a timestamp */ @@ -1931,6 +1932,7 @@ #ifdef FEAT_MBYTE vimenc_atom = XInternAtom(dpy, VIMENC_ATOM_NAME,False); #endif + utf8_atom = XInternAtom(dpy, "UTF8_STRING", False); compound_text_atom = XInternAtom(dpy, "COMPOUND_TEXT", False); text_atom = XInternAtom(dpy, "TEXT", False); targets_atom = XInternAtom(dpy, "TARGETS", False); @@ -2074,7 +2076,7 @@ } #endif - else if (*type == compound_text_atom || ( + else if (*type == utf8_atom || *type == compound_text_atom || ( #ifdef FEAT_MBYTE enc_dbcs != 0 && #endif @@ -2128,7 +2130,7 @@ #else 1 #endif - ; i < 5; i++) + ; i < 6; i++) { switch (i) { @@ -2136,8 +2138,9 @@ case 0: type = vimenc_atom; break; #endif case 1: type = vim_atom; break; - case 2: type = compound_text_atom; break; - case 3: type = text_atom; break; + case 2: type = utf8_atom; break; + case 3: type = compound_text_atom; break; + case 4: type = text_atom; break; default: type = XA_STRING; } success = MAYBE; @@ -2230,7 +2233,7 @@ { Atom *array; - if ((array = (Atom *)XtMalloc((unsigned)(sizeof(Atom) * 6))) == NULL) + if ((array = (Atom *)XtMalloc((unsigned)(sizeof(Atom) * 7))) == NULL) return False; *value = (XtPointer)array; i = 0; @@ -2242,6 +2245,7 @@ array[i++] = vim_atom; array[i++] = text_atom; array[i++] = compound_text_atom; + array[i++] = utf8_atom; *type = XA_ATOM; /* This used to be: *format = sizeof(Atom) * 8; but that caused * crashes on 64 bit machines. (Peter Derr) */ @@ -2255,6 +2259,7 @@ && *target != vimenc_atom #endif && *target != vim_atom + && *target != utf8_atom && *target != text_atom && *target != compound_text_atom) return False; @@ -2282,10 +2287,10 @@ return False; } - if (*target == XA_STRING) + if (*target == XA_STRING || *target == utf8_atom) { mch_memmove(result, string, (size_t)(*length)); - *type = XA_STRING; + *type = *target; } else if (*target == compound_text_atom || *target == text_atom)