mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-17 11:20:09 +00:00
fix(lib): patch omz_urlencode
to not encode UTF-8 chars in Termux (#12076)
Fixes #12061
This commit is contained in:
parent
0a9d82780e
commit
1ae0515a80
1 changed files with 5 additions and 0 deletions
|
@ -182,6 +182,8 @@ function omz_urlencode() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use LC_CTYPE=C to process text byte-by-byte
|
# Use LC_CTYPE=C to process text byte-by-byte
|
||||||
|
# Note that this doesn't work in Termux, as it only has UTF-8 locale.
|
||||||
|
# Characters will be processed as UTF-8, which is fine for URLs.
|
||||||
local i byte ord LC_ALL=C
|
local i byte ord LC_ALL=C
|
||||||
export LC_ALL
|
export LC_ALL
|
||||||
local reserved=';/?:@&=+$,'
|
local reserved=';/?:@&=+$,'
|
||||||
|
@ -206,6 +208,9 @@ function omz_urlencode() {
|
||||||
else
|
else
|
||||||
if [[ "$byte" == " " && -n $spaces_as_plus ]]; then
|
if [[ "$byte" == " " && -n $spaces_as_plus ]]; then
|
||||||
url_str+="+"
|
url_str+="+"
|
||||||
|
elif [[ "$PREFIX" = *com.termux* ]]; then
|
||||||
|
# Termux does not have non-UTF8 locales, so just send the UTF-8 character directly
|
||||||
|
url_str+="$byte"
|
||||||
else
|
else
|
||||||
ord=$(( [##16] #byte ))
|
ord=$(( [##16] #byte ))
|
||||||
url_str+="%$ord"
|
url_str+="%$ord"
|
||||||
|
|
Loading…
Reference in a new issue