diff options
| author | Jack Nagel | 2014-06-14 00:05:20 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-06-14 00:07:24 -0500 |
| commit | bba08d7a67e54e2a7098d1b3eb8d3faa42e0add3 (patch) | |
| tree | 39d760aa3a46346f2c4340656233415a87498d4d /Library | |
| parent | 61c85de28b2f42cfedd4491135e73c1868eef6f7 (diff) | |
| download | homebrew-bba08d7a67e54e2a7098d1b3eb8d3faa42e0add3.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.
Diffstat (limited to 'Library')
| -rwxr-xr-x | Library/Contributions/cmd/brew-test-bot.rb | 6 |
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 |
