Project

General

Profile

Bug #3884

rake does not respect LC_* vars for encoding

Added by kch (Caio Chassot) almost 10 years ago. Updated about 9 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.2p0 (2010-08-18 revision 29034) [universal.x86_64-darwin10.4.0]
Backport:
[ruby-core:32610]

Description

=begin
$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29034) [universal.x86_64-darwin10.4.0]

$ export -n LC_ALL LC_CTYPE LANG
$ ruby -e "puts ENCODING"
US-ASCII

$ LC_ALL="en_US.UTF-8" ruby -e "puts ENCODING"
UTF-8

$ echo "task(:foo) { puts ENCODING }" > Rakefile
$ rake -s foo
US-ASCII

$ LC_ALL="en_US.UTF-8" rake -s foo
US-ASCII

Same for current trunk:

$ ./ruby -v
ruby 1.9.3dev (2010-09-28 trunk 29354) [universal.x64-darwin10.4.0]

$ export -n LC_ALL LC_CTYPE LANG
$ ./ruby -e "puts ENCODING"
US-ASCII

$ LC_ALL="en_US.UTF-8" ./ruby -e "puts ENCODING"
UTF-8

$ echo "task(:foo) { puts ENCODING }" > Rakefile
$ ./bin/rake -s foo
US-ASCII

$ LC_ALL="en_US.UTF-8" ./bin/rake -s foo
US-ASCII

A magic comment on the Rakefile will work, tho.
=end

#1

Updated by nobu (Nobuyoshi Nakada) almost 10 years ago

  • Status changed from Open to Rejected

=begin
LC_* vars only affect the source encoding of -e option, but not of script file.

$ echo 'puts ENCODING' > enc.rb
$ LC_ALL=ja_JP.utf-8 ruby enc.rb
US-ASCII
$ LC_ALL=ja_JP.utf-8 ruby -e 'puts ENCODING'
UTF-8

=end

Also available in: Atom PDF