mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-19 21:41:07 +01:00
Add support for variant "utf8" locale suffix spelling. Fix dumb bug in iconv call that would cause it to hang.
This commit is contained in:
parent
cb37c934c0
commit
88f42b6132
1 changed files with 3 additions and 3 deletions
|
@ -64,12 +64,12 @@ if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
|
||||||
# Returns nonzero if encoding failed
|
# Returns nonzero if encoding failed
|
||||||
function _omz_urlencode() {
|
function _omz_urlencode() {
|
||||||
local str=$1
|
local str=$1
|
||||||
local url_str=''
|
local url_str=""
|
||||||
|
|
||||||
# URLs must use UTF-8 encoding; convert if required
|
# URLs must use UTF-8 encoding; convert if required
|
||||||
local encoding=${LC_CTYPE/*./}
|
local encoding=${LC_CTYPE/*./}
|
||||||
if [[ -n $encoding && $encoding != UTF-8 ]]; then
|
if [[ -n $encoding && $encoding != UTF-8 && $encoding != utf8 ]]; then
|
||||||
str=$(iconv -f $encoding -t UTF-8)
|
str=$(echo $str | iconv -f $encoding -t UTF-8)
|
||||||
if [[ $? != 0 ]]; then
|
if [[ $? != 0 ]]; then
|
||||||
echo "Error converting string from $encoding to UTF-8" >&2
|
echo "Error converting string from $encoding to UTF-8" >&2
|
||||||
return 1
|
return 1
|
||||||
|
|
Loading…
Reference in a new issue