New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to make oink skip lines with bad character encoding #7

wants to merge 4 commits into
base: master

convert log lines to UTF-8 in order to prevent encoding issues when p…

…arsing logs
  • Loading branch information...
Shane Gibbons
Shane Gibbons committed Jan 14, 2011
commit 87b176f45367cacfa9665a39ac9936995b175788
@@ -2,6 +2,7 @@
require "oink/base"
require "oink/oinked_request/oinked_memory_request"
require "oink/priority_queue"
require "iconv"
module Oink
@@ -12,9 +13,10 @@ def print(output)
output.puts "\n-- REQUESTS --\n" if @format == :verbose
ic ='UTF-8//IGNORE', 'UTF-8')
@inputs.each do |input|
input.each_line do |line|
line = line.strip
line = ic.iconv(line.strip + ' ')[0..-2]
# Skip this line since we're only interested in the Hodel 3000 compliant lines
next unless line =~ HODEL_LOG_FORMAT_REGEX
@@ -69,4 +71,4 @@ def print(output)
ProTip! Use n and p to navigate between commits in a pull request.