Skip to content

Commit

Permalink
Fix History.txt processing for empty LANG
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
drbrain committed Nov 24, 2013
1 parent 9e15a10 commit 9ccd8b5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/rubygems/commands/setup_command.rb
Expand Up @@ -124,7 +124,9 @@ def execute
open release_notes do |io|
text = io.gets '==='
text << io.gets('===')
text[0...-3].sub(/^# coding:.*?^=/m, '')
text.force_encoding Encoding::UTF_8 if
Object.const_defined? :Encoding
text[0...-3].sub(/^# coding:.*?^=/mu, '')
end
else
"Oh-no! Unable to find release notes!"
Expand Down

0 comments on commit 9ccd8b5

Please sign in to comment.