Cloudef / bemenu

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

Clipboard: Pasting UTF-8 multibyte sequences broken #410

Open vain opened 5 months ago

vain commented 5 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.