Cloudef / bemenu

Dynamic menu library and client program inspired by dmenu
GNU General Public License v3.0
1.21k stars 94 forks source link

Clipboard: Pasting UTF-8 multibyte sequences broken #410

Open vain opened 3 months ago

vain commented 3 months ago

The pasting code iterates over the bytes we read from wl-paste/xclip and that breaks when you try to paste multibyte sequences:

https://github.com/Cloudef/bemenu/blob/5bc8a6caaa74f2255fbf4ef8185be50c6e3e6fbe/lib/menu.c#L1199-L1203

As an example, select this character: ö and try to paste it.

The code calls bm_unicode_insert(), which expects unicode codepoints, not raw bytes. We have to UTF-8-decode the whole string first.