Experimental feature in GraalVM

设置 UTF-8 本地化

运行某些 Ruby 应用程序需要 UTF-8 本地化。例如,我们发现 RubyGems 和 ruby/spec 需要这种本地化。

如果 $LANG 环境变量已设置,则不需要此操作,并且

locale

不显示 ="C" 且没有警告。相反,所有值应为 "en_US.UTF-8" 或其他区域,但仍为 .UTF-8

基于 Fedora:RHEL、Oracle Linux 等 #

export LANG=en_US.UTF-8

基于 Debian:Ubuntu 等 #

Ubuntu

Ubuntu 版本的 locale-gen 支持参数,因此操作很简单

sudo apt-get install -y locales
sudo locale-gen en_US.UTF-8
export LANG=en_US.UTF-8

非 Ubuntu

Debian 和其他非 Ubuntu 版本不支持 locale-gen 参数。相反,您需要修改 /etc/locale.gen

# Uncomment the en_US.UTF-8 line in /etc/locale.gen
sudo sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen

# locale-gen generates locales for all uncommented locales in /etc/locale.gen
sudo locale-gen
export LANG=en_US.UTF-8

适用于 Dockerfile

# Uncomment the en_US.UTF-8 line in /etc/locale.gen
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen
# locale-gen generates locales for all uncommented locales in /etc/locale.gen
RUN locale-gen
ENV LANG=en_US.UTF-8

联系我们