aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/test-bot.rb
diff options
context:
space:
mode:
authorXu Cheng2016-03-14 20:20:42 +0800
committerXu Cheng2016-03-14 20:33:35 +0800
commit60055ba8901dfe2844c323101d2e425ce800cf2e (patch)
tree159173aeed3d8aad2263a64501b4a946ba32b50f /Library/Homebrew/cmd/test-bot.rb
parenta6b918d6c5cd8a05494002d288f15d9b7b30f9df (diff)
downloadbrew-60055ba8901dfe2844c323101d2e425ce800cf2e.tar.bz2
test-bot: fix encoding caused by UTF-8 regex
Diffstat (limited to 'Library/Homebrew/cmd/test-bot.rb')
-rw-r--r--Library/Homebrew/cmd/test-bot.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/Library/Homebrew/cmd/test-bot.rb b/Library/Homebrew/cmd/test-bot.rb
index 6706c1b29..74ba99975 100644
--- a/Library/Homebrew/cmd/test-bot.rb
+++ b/Library/Homebrew/cmd/test-bot.rb
@@ -919,7 +919,9 @@ module Homebrew
if step.has_output?
# Remove invalid XML characters
# http://www.w3.org/TR/xml/#charsets
- output = step.output.gsub(/[^\x09\x0A\x0D\x20-\uD7FF\uE000-\uFFFD\u10000-\u10FFFF]/, "")
+ output = step.output
+ output.force_encoding("UTF-8") if output.respond_to?(:force_encoding)
+ output.gsub!(/[^\x09\x0A\x0D\x20-\uD7FF\uE000-\uFFFD\u10000-\u10FFFF]/, "")
if output.bytesize > BYTES_IN_1_MEGABYTE
output = "truncated output to 1MB:\n" \