termux里面安装的mobox中文显示乱码怎么解决?

Создано: 6 сентября 2025 г.

Отвечено с использованием GPT-5 Thinking от Chat01

Вопрос

termux里面安装的mobox中文显示乱码怎么解决?

Мысль

Addressing Chinese display issue in Mobox

The issue seems to stem from locale and font settings. To fix it, ensure the locale is set to UTF-8 in both Termux and the container (Ubuntu/Proot). For Wine, you might need to install CJK fonts like "fonts-wqy-microhei" or "fonts-noto-cjk". Also, check Termux's font selection settings and switch to a font that supports Chinese, like Noto Sans Mono CJK.

Addressing font and locale issues in Termux

For font issues, "Sarasa Mono SC Nerd" might be a good choice, or you could try "Noto Sans Mono CJK." Garbled text could occur in either Termux:X11 or Mobox's desktop environment. Make sure to install fonts-noto-cjk, set LANG=zh_CN.UTF-8 and LC_ALL=zh_CN.UTF-8, and consider copying fonts to the Wine directory. Termux lacks full locale support, but setting environment variables helps.

Displaying Chinese in Termux

To display Chinese, set LANG to C.UTF-8 or zh_CN.UTF-8. The default LANG is en_US.UTF-8, but using a Chinese-compatible font is key. Install fonts like noto-fonts-cjk in Termux via fontconfig, though this may not be available. Mobox containers should support Chinese fonts like fonts-noto-cjk.

Troubleshooting Chinese display in Termux and Mobox

  1. Check where the garbled characters appear: in Termux terminal, Termux:X11, or Wine.
  2. In Termux, install Chinese fonts (e.g., "更纱黑体 Mono SC Nerd") by downloading and placing them in /.termux/font.ttf and restarting Termux.
  3. In Mobox/Linux container, use apt install fonts-noto-cjk fonts-wqy-microhei and run fc-cache -fv.
  4. Set locale to zh_CN.UTF-8 in the container and .profile.
  5. In Wine, install or copy fonts like simsun.ttc and msyh.ttc into /.wine/drive_c/windows/Fonts/.

Thought for 59s

Ответ

看哪里“乱码”先分清:

  1. 只是 Termux 终端里中文变方块/问号;2) 在 Termux:X11/Mobox 的图形界面里中文是方块;3) Wine 打开的 Windows 程序里中文是方块或乱码。不同场景处理不一样——按需做对应步骤即可。

场景 A|Termux 终端里中文乱码

根因:终端字体不含 CJK 或环境变量不是 UTF-8。
解决

  1. 给 Termux 换一款带中文的等宽字体(如“更纱黑体 Mono SC / Sarasa Mono SC”或 Noto CJK 等)。把字体文件命名为 font.ttf 放到 ~/.termux/,重启 Termux 即生效。(ask.csdn.net, my.oschina.net)
  2. 确保是 UTF-8:
bash
echo 'export LANG=C.UTF-8' >> ~/.profile echo 'export LC_ALL=C.UTF-8' >> ~/.profile . ~/.profile

场景 B|Termux:X11 / Mobox 图形界面中文是“口口口”

根因:容器里缺中文字体/locale 或字体缓存未刷新。Mobox 是在 Termux 上通过 Termux:X11 跑 Linux + Wine 的一套脚本/环境。(GitHub, XDA Developers)
解决(在 Mobox 的 Linux 容器里执行)

bash
# 1) 字体与字体配置 sudo apt update sudo apt install -y fontconfig locales \ fonts-noto-cjk fonts-wqy-zenhei fonts-wqy-microhei # 2) 生成中文 locale(Ubuntu/Debian) sudo sed -i 's/^# *zh_CN.UTF-8 UTF-8/zh_CN.UTF-8 UTF-8/' /etc/locale.gen sudo locale-gen sudo update-locale LANG=zh_CN.UTF-8 LC_CTYPE=zh_CN.UTF-8 # 3) 刷新字体缓存 fc-cache -fv

做完重启 Mobox/Termux:X11。若你之前跑过“汉化脚本”后菜单变方块,这通常也是缺 CJK 字体导致,按上面安装字体后即可恢复正常。(tieba.baidu.com)

场景 C|Wine 里的 Windows 程序中文乱码/方块

根因:Wine 前缀里缺中文 Windows 字体。
解决(在容器里执行)

bash
# 安装 winetricks 并一键装常用中文字体 sudo apt install -y winetricks cabextract winetricks -q cjkfonts # 或:winetricks -q allfonts # 确认 Wine 前缀路径(不设时默认 ~/.wine) echo "${WINEPREFIX:-$HOME/.wine}"

也可以把 simsun.ttcmsyh.ttc 等放进 $WINEPREFIX/drive_c/windows/Fonts/,再 fc-cache -fv。完成后重启对应程序即可。(Mobox 基于 Termux:X11 + Wine 跑应用,中文显示依赖 Wine 前缀里的字体。)(GitHub, XDA Developers)


小提示

  • 如果只是 Termux:X11 里中文没有而终端里正常,优先安装容器内字体(场景 B)。
  • 若仍有个别软件显示成方块,给 ~/.config/fontconfig/fonts.conf 增加 CJK 字体优先级通常也能治标(Noto CJK / 文泉驿)。(oryoy.com)
  • Mobox 的中文输入、分辨率等与 Termux:X11 设置有关,官方/社区教程里也有说明。(GitHub, tieba.baidu.com)

如果你说下具体哪一步出现乱码(终端/图形界面/Wine 程序名),我可以把命令按你的环境精确到位。

Поделиться этим Q&A