Subject: zle -U "$selected" doesn't handle (some?) multibyte characters
From: Sebastian Gniazdowski <[email-masked]>
To: Zsh hackers list <[email-masked]>
Date: Sun, 10 Jan 2016 09:18:38 +0100
List-Id: Zsh Workers List <zsh-workers.zsh.org>

I have a following code in which "$selected" resolves to "The\ Voice\
of\ Poland\ VI\ –\ Marta\ Moszczyńska\ –\ „Sail”\ –\
Live-h9KgwUAlCjE.mkv":

if [ "$REPLY" -gt 0 ]; then
    selected="$reply[REPLY]"
    echo "$selected" > /tmp/d
    # ZLE?
    if [ "${(t)CURSOR}" = "integer-local-special" ]; then
        zle redisplay
        zle kill-whole-line
        zle -U "$selected"
    else
        print -zr "$selected"
    fi
else
    [ "${(t)CURSOR}" = "integer-local-special" ] && zle redisplay
fi

So two paths, one for the script being run from Zle, and other one
when run as function. The function path works, string is not
disrupted. The "echo" also outputs non-disrupted string. However, zle
-U "$selected" outputs: "The\ Voice\ of\ Poland\ VI\  \ Marta\
MoszczyŃska\  \  Sail \  \ Live-h9KgwUAlCjE.mkv"

The quotation marks are missing. The letter "ń" is also disrupted and
outputted as "Ń"

Best regards,
Sebastian Gniazdowski