diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb index cf0fdd00d2af..8bfc1d7ecfe0 100644 --- a/lib/rubygems/commands/setup_command.rb +++ b/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, '') end else "Oh-no! Unable to find release notes!"