Skip to content

Commit 9ccd8b5

Browse files
committed
Fix History.txt processing for empty LANG
When LANG=UTF-8 some versions of ruby are not able to correctly process the History file and raise an encoding exception (notably, FreeBSD). This ensures the History text is processed with UTF-8 encoding.
1 parent 9e15a10 commit 9ccd8b5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/rubygems/commands/setup_command.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ def execute
124124
open release_notes do |io|
125125
text = io.gets '==='
126126
text << io.gets('===')
127-
text[0...-3].sub(/^# coding:.*?^=/m, '')
127+
text.force_encoding Encoding::UTF_8 if
128+
Object.const_defined? :Encoding
129+
text[0...-3].sub(/^# coding:.*?^=/mu, '')
128130
end
129131
else
130132
"Oh-no! Unable to find release notes!"

0 commit comments

Comments
 (0)