Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
	T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=mime-version:from:date:message-id:subject:to:content-type
         :content-transfer-encoding;
        bh=rinICkBTuhUPVtJijLqF3WUnR7wAC58O+K2/pFPxVNo=;
        b=HUks/9rVsl+TTPo1Jk6hN09tlBY8ePvIL6Ic69dbPABllKZ7M1qMBCyfSeKPIMJagi
         EwsjitnARz9uGvdKdC3EQGuuQH1V6D79f/x/+iCXaHLNQCcAy8ZyyG8MovE3d7t1J+gK
         nURv/Z5tv+Kqnmd3baXRW/uC3ZJYTekiyXXqZQACdQD8GWb6LKoQlztz6s2+hQm7gKgw
         GgF+674yNEoC1N1AijTw7wzBPK5GQ5MRMXe+scpewiZCLhn6cb+4aWf2mCC7jK6a0sBw
         tzD3qpXAL90BU8cz4fATbasrYIS7r18zTLLu3+Pdwsii2p3oMEwHLhQbcFUnObd9Fp+b
         PqJw==
X-Received: by 10.112.137.129 with SMTP id qi1mr10138376lbb.31.1452413938258;
 Sun, 10 Jan 2016 00:18:58 -0800 (PST)
MIME-Version: 1.0
From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
Date: Sun, 10 Jan 2016 09:18:38 +0100
Message-ID: <CAKc7PVD7N_xaeXSZHB1Q4kmzayjiPA5BNTwkDM5mQF-Zj9SmFg@mail.gmail.com>
Subject: zle -U "$selected" doesn't handle (some?) multibyte characters
To: Zsh hackers list <zsh-workers@zsh.org>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Seq: zsh-workers 37536

I have a following code in which "$selected" resolves to "The\ Voice\
of\ Poland\ VI\ =E2=80=93\ Marta\ Moszczy=C5=84ska\ =E2=80=93\ =E2=80=9ESai=
l=E2=80=9D\ =E2=80=93\
Live-h9KgwUAlCjE.mkv":

if [ "$REPLY" -gt 0 ]; then
    selected=3D"$reply[REPLY]"
    echo "$selected" > /tmp/d
    # ZLE?
    if [ "${(t)CURSOR}" =3D "integer-local-special" ]; then
        zle redisplay
        zle kill-whole-line
        zle -U "$selected"
    else
        print -zr "$selected"
    fi
else
    [ "${(t)CURSOR}" =3D "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\ =E2=80=83\ Marta\
Moszczy=C5=83ska\ =E2=80=83\ =E2=80=83Sail=E2=80=83\ =E2=80=83\ Live-h9KgwU=
AlCjE.mkv"

The quotation marks are missing. The letter "=C5=84" is also disrupted and
outputted as "=C5=83"

Best regards,
Sebastian Gniazdowski

