Skip to content

Commit 1bcbc7f

Browse files
committed
Use a pattern that works on 1.8.7
1 parent ef0aa61 commit 1bcbc7f

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Diff for: lib/rubygems/text.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module Gem::Text
1010
# Remove any non-printable characters and make the text suitable for
1111
# printing.
1212
def clean_text(text)
13-
text.gsub(/[\u0000-\u0008\u000b-\u000c\u000e-\u001F\u007f]/, ".".freeze)
13+
text.gsub(/[\000-\b\v-\f\016-\037\177]/, ".".freeze)
1414
end
1515

1616
##

Diff for: test/rubygems/test_gem_commands_query_command.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ def test_execute_details_cleans_text
132132
spec_fetcher do |fetcher|
133133
fetcher.spec 'a', 2 do |s|
134134
s.summary = 'This is a lot of text. ' * 4
135-
s.authors = ["Abraham Lincoln \u0001", "\u0002 Hirohito"]
136-
s.homepage = "http://a.example.com/\u0003"
135+
s.authors = ["Abraham Lincoln \x01", "\x02 Hirohito"]
136+
s.homepage = "http://a.example.com/\x03"
137137
end
138138

139139
fetcher.legacy_platform

Diff for: test/rubygems/test_gem_text.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_format_text_trailing # for two spaces after .
3737
end
3838

3939
def test_format_removes_nonprintable_characters
40-
assert_equal "text with weird .. stuff", format_text("text with weird \u001b\u0002 stuff", 40)
40+
assert_equal "text with weird .. stuff .", format_text("text with weird \x1b\x02 stuff \x7f", 40)
4141
end
4242

4343
def test_min3

0 commit comments

Comments
 (0)