[ruby/yarp] Support LANG=C environments in template.rb

https://github.com/ruby/yarp/commit/885d731cf5
This commit is contained in:
Takashi Kokubun 2023-09-01 16:33:22 -07:00 committed by git
parent d89b15cdce
commit 3c41ef4749

View File

@ -339,7 +339,10 @@ end
if __FILE__ == $0 if __FILE__ == $0
if ARGV.empty? if ARGV.empty?
YARP::TEMPLATES.each { |filepath| YARP.template(filepath) } YARP::TEMPLATES.each { |filepath| YARP.template(filepath) }
else else # ruby/ruby
if ENV["LANG"] == "C"
Encoding.default_external = Encoding::UTF_8
end
name, write_to = ARGV name, write_to = ARGV
YARP.template(name, write_to: write_to) YARP.template(name, write_to: write_to)
end end