From 345c2b2b67cde33de7825a2cde32316900793fe9 Mon Sep 17 00:00:00 2001 From: spag Date: Tue, 12 Feb 2013 23:30:50 +0100 Subject: remove non-ascii characters from whois reply --- app/models/intruder.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'app/models/intruder.rb') diff --git a/app/models/intruder.rb b/app/models/intruder.rb index 8877c4c..249fffc 100644 --- a/app/models/intruder.rb +++ b/app/models/intruder.rb @@ -17,11 +17,14 @@ class Intruder < ActiveRecord::Base before_validation :set_key_if_empty + def to_s + key + end def whois(ip_address = self.contact_ip) if ! ip_address.blank? begin - return Whois.whois(ip_address).to_s.gsub(/[^A-Za-z0-9\:\_\-\ \+\.\,\n]/, '') + return Whois.whois(ip_address).to_s.gsub(/[^\u{0000}-\u{007F}]/, '') rescue return nil end -- cgit v1.2.3