Browse files

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.
  • Loading branch information...
1 parent 9e15a10 commit 9ccd8b5f48e04620e3c57aa4065218fa184977bf @drbrain drbrain committed Nov 24, 2013
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/rubygems/commands/setup_command.rb
@@ -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, '')
"Oh-no! Unable to find release notes!"

0 comments on commit 9ccd8b5

Please sign in to comment.