Project

General

Profile

Actions

Bug #12127

closed

LANG environment is not respected

Added by vo.x (Vit Ondruch) about 8 years ago. Updated about 8 years ago.

Status:
Third Party's Issue
Assignee:
-
Target version:
-
[ruby-core:74054]

Description

Ruby 2.2:

$ ruby -v
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-linux]

$ ruby -e "puts ''.encoding"
US-ASCII

$ LANG=en_US.utf-8 ruby -e "puts ''.encoding"
UTF-8

Ruby 2.3:

$ ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]

$ ruby -e "puts ''.encoding"
US-ASCII

$ LANG=en_US.utf-8 ruby -e "puts ''.encoding"
US-ASCII

Updated by duerst (Martin Dürst) about 8 years ago

  • Status changed from Open to Feedback

Can you explain what the problem is with

$ LANG=en_US.utf-8 ruby -e "puts ''.encoding"
US-ASCII

As far as I understand, strings with an encoding of US-ASCII can be used wherever an UTF-8 string can be used, so this shouldn't create any new errors.

Updated by naruse (Yui NARUSE) about 8 years ago

I can't reproduce it.
Could you show ruby/ruby -ve "p Encoding.find('locale');puts ''.encoding"?

Updated by vo.x (Vit Ondruch) about 8 years ago

  • Status changed from Feedback to Third Party's Issue

Yui NARUSE wrote:

I can't reproduce it.
Could you show ruby/ruby -ve "p Encoding.find('locale');puts ''.encoding"?

$ ruby -ve "p Encoding.find('locale');puts ''.encoding"
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
#<Encoding:US-ASCII>
US-ASCII

Actually, I suspect this my have something to do with recent changes in packaging of glibc in Fedora [1]. I don't have any locales installed, except the default C.UTF-8, which works just fine:

$ LANG=C.UTF-8 ruby -e "puts ''.encoding"
UTF-8

If I install all langpacks, the command above works just fine. So it is likely third party issue. I guess that Ruby probably cannot respect just the UTF-8 part ....

[1] http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/commit/?id=f2d40207eae526f4183c755c1c16aed2daec0279

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0