From c065de3b2446a2ddbe8c9afd6fb6a96d93dbbad6 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 12 Sep 2016 16:59:48 -0700 Subject: [PATCH] Add a note about Encoding in Ruby --- ruby/content.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ruby/content.md b/ruby/content.md index 33ce779e0..b276c553d 100644 --- a/ruby/content.md +++ b/ruby/content.md @@ -42,3 +42,7 @@ For many simple, single file projects, you may find it inconvenient to write a c ```console $ docker run -it --rm --name my-running-script -v "$PWD":/usr/src/myapp -w /usr/src/myapp ruby:2.1 ruby your-daemon-or-script.rb ``` + +## Encoding + +By default, Ruby inherits the locale of the environment in which it is run. For most users running Ruby on their desktop systems, that means it's likely using some variation of `*.UTF-8` (`en_US.UTF-8`, etc). In Docker however, the default locale is `C`, which can have unexpected results. If your application needs to interact with UTF-8, it is recommended that you explicitly adjust the locale of your image/container via `-e LANG=C.UTF-8` or `ENV LANG C.UTF-8`.