aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2014-06-14 00:05:20 -0500
committerJack Nagel2014-06-14 00:07:24 -0500
commit03488424cb8faf5d82f81767fa9a1442d5ce386a (patch)
tree9529d6f799f717386abaf4e116d7c304aea5a069
parent4b07dbbf786d1f0896841561f92234c11e182c61 (diff)
downloadbrew-03488424cb8faf5d82f81767fa9a1442d5ce386a.tar.bz2
Handle non-ASCII output encoded as ASCII
Some tool involved in `brew install node` is emitting UTF-8 even though LANG and LC_ALL are unset. Since the external encoding is US-ASCII, we need to guard against bad data here.
-rwxr-xr-xLibrary/Contributions/cmd/brew-test-bot.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/Library/Contributions/cmd/brew-test-bot.rb b/Library/Contributions/cmd/brew-test-bot.rb
index a9ad48ae2..8ffa7998c 100755
--- a/Library/Contributions/cmd/brew-test-bot.rb
+++ b/Library/Contributions/cmd/brew-test-bot.rb
@@ -522,7 +522,11 @@ if ARGV.include? "--junit"
failure = testcase.add_element 'failure' if step.failed?
if step.has_output?
# Remove invalid XML CData characters from step output.
- output = REXML::CData.new step.output.delete("\000\a\b\e\f")
+ output = step.output
+ if output.respond_to?(:force_encoding) && !output.valid_encoding?
+ output.force_encoding(Encoding::UTF_8)
+ end
+ output = REXML::CData.new output.delete("\000\a\b\e\f")
if step.passed?
system_out = testcase.add_element 'system-out'
system_out.text = output