From da3b8fcb6a6bcf4d440b9768d2deab27f787929a Mon Sep 17 00:00:00 2001
From: Lukas Elmer <lukas.elmer@gmail.com>
Date: Wed, 11 Oct 2023 18:06:22 +0200
Subject: [PATCH] fix(yarn): output completion entries in UTF-8 (#11955)

---
 plugins/yarn/_yarn | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/yarn/_yarn b/plugins/yarn/_yarn
index 1237ba67..f15756ff 100644
--- a/plugins/yarn/_yarn
+++ b/plugins/yarn/_yarn
@@ -144,7 +144,7 @@ _yarn_scripts() {
   fi
 
   if [[ -n $packageJson ]]; then
-    scripts=("${(@f)$(cat ${packageJson} | perl -0777 -MJSON::PP -n -E '%r=%{decode_json($_)->{scripts}}; do{$k=$_;($e=$k)=~s/:/\\:/g; printf "$e:$r{$k}\n"} for sort keys %r')}")
+    scripts=("${(@f)$(cat ${packageJson} | perl -0777 -MJSON::PP -n -E 'binmode(STDOUT, ":encoding(UTF-8)"); %r=%{decode_json($_)->{scripts}}; do{$k=$_;($e=$k)=~s/:/\\:/g; printf "$e:$r{$k}\n"} for sort keys %r')}")
   fi
 
   commands=('env' $scripts $binaries)