summaryrefslogtreecommitdiff
path: root/internal/icons.zsh
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2019-08-20 15:56:43 +0300
committerromkatv <roman.perepelitsa@gmail.com>2019-08-20 15:56:43 +0300
commite537a0ee628341741f20a7d2d96ea1c4fac74c4a (patch)
tree722bb8233e62285114ca22f0b684595061229777 /internal/icons.zsh
parenta5e9af847d7052d920a340e12b823e600ae10a9e (diff)
better utf-8 handling
Diffstat (limited to 'internal/icons.zsh')
-rwxr-xr-xinternal/icons.zsh12
1 files changed, 7 insertions, 5 deletions
diff --git a/internal/icons.zsh b/internal/icons.zsh
index e93712c4..fd2ab1be 100755
--- a/internal/icons.zsh
+++ b/internal/icons.zsh
@@ -3,9 +3,11 @@ typeset -gA icons
function _p9k_init_icons() {
[[ $+_p9k_icon_mode == 1 && $_p9k_icon_mode == $POWERLEVEL9K_MODE ]] && return
typeset -g _p9k_icon_mode=$POWERLEVEL9K_MODE
- typeset -g _p9k_locale=${LC_ALL:-$LANG}
- if [[ $_p9k_locale != *.(utf|UTF)(-|)8 ]]; then
- _p9k_locale=${${(@M)$(locale -a):#*.(utf|UTF)(-|)8}[1]:-en_US.UTF-8}
+ zmodload zsh/langinfo
+ if [[ ${langinfo[CODESET]:-} != (utf|UTF)(-|)8 ]]; then
+ typeset -g _p9k_locale=${${(@M)$(locale -a):#*.(utf|UTF)(-|)8}[1]:-en_US.UTF-8}
+ else
+ typeset -g _p9k_locale=
fi
case $POWERLEVEL9K_MODE in
@@ -535,7 +537,7 @@ function _p9k_init_icons() {
function print_icon() {
emulate -L zsh && setopt no_hist_expand extended_glob no_prompt_bang prompt_{cr,percent,subst,sp}
_p9k_init_icons
- local LC_ALL=$_p9k_locale
+ [[ -z $_p9k_locale ]] || local LC_ALL=$_p9k_locale
local icon_name=$1
local var_name=POWERLEVEL9K_${icon_name}
if [[ -n "${(tP)var_name}" ]]; then
@@ -553,7 +555,7 @@ function print_icon() {
function get_icon_names() {
emulate -L zsh && setopt no_hist_expand extended_glob no_prompt_bang prompt_{cr,percent,subst,sp}
_p9k_init_icons
- local LC_ALL=$_p9k_locale
+ [[ -z $_p9k_locale ]] || local LC_ALL=$_p9k_locale
# Iterate over a ordered list of keys of the icons array
for key in ${(@kon)icons}; do
echo -n "POWERLEVEL9K_$key: "