環境情報
RedHat Enterprise Linux 7.1
事象
bash
[root@aaaa yum.repos.d]# yum search zsh
読み込んだプラグイン:langpacks, product-id, subscription-manager
'ascii' codec can't decode byte 0xe3 in position 0: ordinal not in range(128)
============================================ N/S matched: zsh ============================================
zsh-html.x86_64 : Zsh shell manual in html format
zsh.x86_64 : Powerful interactive shell
Name and summary matches only, use "search all" for everything.
なんか出てきた
bash
'ascii' codec can't decode byte 0xe3 in position 0: ordinal not in range(128)
公式サイトの対応法
原因
- yumdb が破損している可能性がある
- 言語環境がUTF-8になっていない
対策
1やってだめなら、2をやりましょう
1. yumdbを消す
bash
mv /var/lib/yum/yumdb/ /tmp
yumdb sync
2. pythonデフォルトエンコーディングの変更
どうやらyumはpythonスクリプトのようです。
vi /usr/lib/python2.7/site-packages/sitecustomize.py
import sys
sys.setdefaultencoding("utf-8")
結論
CentOSではならなかったので、RedHatが悪い。