Browse files

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

…arsing logs
  • Loading branch information...
1 parent f22d1ef commit 87b176f45367cacfa9665a39ac9936995b175788 Shane Gibbons committed Jan 14, 2011
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/oink/memory_usage_reporter.rb
View
6 lib/oink/memory_usage_reporter.rb
@@ -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 = Iconv.new('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)
end
-end
+end

0 comments on commit 87b176f

Please sign in to comment.