Difference between `en_US.UTF-8` and `c.UTF-8`?



My problem is similar to this:

But I can hopefully provide some more information.

Right now I have

      LC_ALL: en_US.UTF-8
      LANG: en_US.UTF-8
      - image: circleci/ruby:2.3

When running my test I get this output in between:

/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

I honestly don’t know which line of code is causing this, as the code doesn’t really try to set the locale as far as I know.

A bit later I get this error:

Encoding::CompatibilityError: [!] incompatible character encodings: US-ASCII and UTF-8


By googling around I found advice to change en_US.UTF-8 to c.UTF-8 - and this does indeed solve the problem for me. Both initial warning and crashing error are gone.

Why does this work?
Is there another, better way?

(The project originally is built on macOS, where en_US.UTF-8 is used and everything is fine.)


Hi Jan,

I saw this https://github.com/tianon/docker-brew-debian/issues/45 which is interesting since our images are mostly based off of Debian. It seems to be a docker + Debian specific issue.

Does the workaround suggested in that issue resolve your issue? If so we should be able to update our images to include these values by default.


Ok, from reading the issue you linked and following some of the links there C.UTF-8 is actually good enough for my case, so I will just keep it for Ubuntu.


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.