openSUSE更新后rxvt-unicode(urxvt-256color) UTF-8显示异常求助
urxvt 更新后 UTF-8 字符显示异常解决建议
问题描述
使用 openSUSE Tumbleweed(版本20231008),执行sudo zypper dup更新后,rxvt-unicode(使用urxvt-256color)无法正常显示UTF-8字符(如日语ビール),显示为乱码(如æ¨等),重装urxvt后问题依旧。
环境信息
Locale 配置
% locale LANG=ja_JP.UTF-8 LC_CTYPE="ja_JP.UTF-8" LC_NUMERIC="ja_JP.UTF-8" LC_TIME="ja_JP.UTF-8" LC_COLLATE="ja_JP.UTF-8" LC_MONETARY="ja_JP.UTF-8" LC_MESSAGES="ja_JP.UTF-8" LC_PAPER="ja_JP.UTF-8" LC_NAME="ja_JP.UTF-8" LC_ADDRESS="ja_JP.UTF-8" LC_TELEPHONE="ja_JP.UTF-8" LC_MEASUREMENT="ja_JP.UTF-8" LC_IDENTIFICATION="ja_JP.UTF-8" LC_ALL=
urxvt 版本
rxvt-unicode (urxvt) v9.30 - released: 2021-11-27 options: perl,xft,styles,combining,blink,iso14755,unicode3,encodings=eu+vn+jp+jp-ext+kr+zh+zh-ext,fade,transparent,tint,pixbuf,XIM,8bitctrls,frills,selectionscrolling,wheel,slipwheel,smart-resize,cursorBlink,pointerBlank,scrollbars=plain+rxvt+NeXT+xterm
.Xresources 配置
rxvt*saveLines: 200 ! do not scroll with output URxvt*scrollTtyOutput: false ! scroll in relation to buffer (with mouse scroll or Shift+Page Up) URxvt*scrollWithBuffer: true ! scroll back to the bottom on keypress URxvt*scrollTtyKeypress: true URxvt.font: xft:Berkeley Mono:pixelsize=18 URxvt.perl-ext-common: default,matcher,resize-font,fullscreen URxvt.url-launcher: /usr/bin/xdg-open URxvt.matcher.button: 1 URxvt.keysym.F11: perl:fullscreen:switch ! Kill some default key bindings such as Ctrl+Shift+... URxvt.iso14755: false URxvt.iso14755_52: false ! Fix font space !URxvt*letterSpace: -1 !! Color Scheme and Opacity - gruvbox-dark URxvt.depth: 32 URxvt.color0: [90]#282828 URxvt.color1: [90]#cc241d URxvt.color2: [90]#98971a URxvt.color3: [90]#d79921 URxvt.color4: [90]#458588 URxvt.color5: [90]#b16286 URxvt.color6: [90]#689d6a URxvt.color7: [90]#a89984 URxvt.color8: [90]#928374 URxvt.color9: [90]#fb4934 URxvt.color10: [90]#b8bb26 URxvt.color11: [90]#fabd2f URxvt.color12: [90]#83a598 URxvt.color13: [90]#d3869b URxvt.color14: [90]#8ec07c URxvt.color15: [90]#ebdbb2 URxvt.foreground: [90]#ebdbb2 URxvt.background: [90]#282828 URxvt.colorIT: [90]#8ec07c URxvt.colorBD: [90]#d5c4a1 URxvt.colorUL: [90]#83a598 URxvt.scrollColor: [90]#504945 !URxvt.troughColor: [90]#3C3836 emacs.FontBackend: xft
系统版本
% cat /etc/os-release NAME="openSUSE Tumbleweed" # VERSION="20231008" ID="opensuse-tumbleweed" ID_LIKE="opensuse suse" VERSION_ID="20231008" PRETTY_NAME="openSUSE Tumbleweed" ANSI_COLOR="0;32" CPE_NAME="cpe:/o:opensuse:tumbleweed:20231008" BUG_REPORT_URL="https://bugzilla.opensuse.org" SUPPORT_URL="https://bugs.opensuse.org" HOME_URL="https://www.opensuse.org" DOCUMENTATION_URL="https://en.opensuse.org/Portal:Tumbleweed" LOGO="distributor-logo-Tumbleweed"
解决步骤
- 强制urxvt使用UTF-8编码:在
.Xresources中添加一行URxvt.encoding: utf-8,执行xrdb -merge ~/.Xresources后重启urxvt测试。 - 添加日语字体 fallback:当前使用的Berkeley Mono可能不支持日语字符,修改
.Xresources中的字体配置为:
执行URxvt.font: xft:Berkeley Mono:pixelsize=18,xft:Noto Sans JP:pixelsize=18xrdb -merge ~/.Xresources后重启urxvt,若未安装Noto Sans JP,可执行sudo zypper install noto-sans-jp安装。 - 统一LC_ALL变量:临时设置
export LC_ALL=ja_JP.UTF-8,在当前终端启动urxvt测试;若有效,将LC_ALL=ja_JP.UTF-8添加到~/.bashrc或~/.zshrc中。 - 验证基础环境:在xterm中输入
echo ビール,若显示正常则问题集中在urxvt;若同样乱码,执行sudo locale-gen ja_JP.UTF-8重新生成locale。 - 替换urxvt版本:尝试安装多语言版本:
sudo zypper install rxvt-unicode-ml,替换原版本测试。
内容的提问来源于stack exchange,提问作者Windymelt
相关产品推荐
相关产品推荐

