opscode/chef — pull request #2222 by mcquin (2014-10-13 21:47:12+00:00)
Title: Better handling of locale -a output

This fixes https://github.com/opscode/chef/issues/2181.

What was going wrong:
1. `locale -a` works on CentOS 6, but `split`ing the result was raising an argument error since it contained invalid UTF-8 characters. Fixed [here](https://github.com/opscode/chef/blob/473089900f6aad1b12273a904f3a228159c1d1f7/lib/chef/config.rb#L615) by replacing invalid characters in the output's encoding.
2. `locale -a` returns "en_US.utf8" instead of "en_US.UTF-8", even though `LANG=en_US.UTF-8` on my box by default. Added a case and modified the regex to check for "utf8".

Trying to figure out how to stub backticks, so specs are pending but it manually checks out.

\cc @opscode/client-engineers