Skip to content

Latest commit

 

History

History
59 lines (45 loc) · 1.38 KB

utf8-locale.md

File metadata and controls

59 lines (45 loc) · 1.38 KB
layout toc_group link_title permalink
docs-experimental
ruby
Setting up a UTF-8 Locale
/reference-manual/ruby/UTF8Locale/

Setting Up a UTF-8 Locale

You need a UTF-8 locale to run some Ruby applications. For example, we have found that RubyGems and ruby/spec need such a locale.

This is not needed if the $LANG environment variable is already set and:

locale

shows no ="C" and no warning. Instead, all values should be "en_US.UTF-8" or other regions but still .UTF-8.

Fedora-based: RHEL, Oracle Linux, etc

export LANG=en_US.UTF-8

Debian-based: Ubuntu, etc

Ubuntu

The Ubuntu version of locale-gen supports arguments, so it is easy:

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

Non-Ubuntu

Debian and other non-Ubuntu do not support locale-gen arguments. Instead you need to modify /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

For Dockerfile's:

# 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