88f42b6132adedff7557170168416d575569b56e

Author
Andrew Janke <janke@pobox.com>
Committer
Andrew Janke <janke@pobox.com>
Date

Message

Add support for variant "utf8" locale suffix spelling. Fix dumb bug in iconv call that would cause it to hang.

Diff

 1diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh
 2index 7cb3791e688fb66456cad0596d3f28e2e7491a31..52622f5ab931d5fd99823063c5b837044d7e9c07 100644
 3--- a/lib/termsupport.zsh
 4+++ b/lib/termsupport.zsh
 5@@ -64,12 +64,12 @@ if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
 6   # Returns nonzero if encoding failed
 7   function _omz_urlencode() {
 8     local str=$1
 9-    local url_str=''
10+    local url_str=""
11 
12     # URLs must use UTF-8 encoding; convert if required
13     local encoding=${LC_CTYPE/*./}
14-    if [[ -n $encoding && $encoding != UTF-8 ]]; then
15-      str=$(iconv -f $encoding -t UTF-8)
16+    if [[ -n $encoding && $encoding != UTF-8 && $encoding != utf8 ]]; then
17+      str=$(echo $str | iconv -f $encoding -t UTF-8)
18       if [[ $? != 0 ]]; then
19         echo "Error converting string from $encoding to UTF-8" >&2
20         return 1