noahd1 / oink

Log parser to identify actions which significantly increase VM heap size
MIT License
1.18k stars 71 forks source link

Scrub out characters with invalid encoding #32

Open ghost opened 10 years ago

ghost commented 10 years ago

I know the String#scrub method is new, so I check to make sure we're on a ruby that supports this... maybe someone else could chime in about a more compatible way to do this across versions.

Thanks!

ghost commented 10 years ago

A bit of background for the motivation... ran into this error when running bin/oin log/* :

---- MEMORY THRESHOLD ----
THRESHOLD: 75 MB
/home/slackz/repos/theclymb/.bundle/ruby/2.1.0/gems/oink-0.10.1/lib/oink/reports/memory_usage_report.rb:20:in `=~': invalid byte sequence in UTF-8 (ArgumentError)
    from /home/slackz/repos/theclymb/.bundle/ruby/2.1.0/gems/oink-0.10.1/lib/oink/reports/memory_usage_report.rb:20:in `block (2 levels) in print'