gsub ASCII code characters from a string in ruby

Viewed 10398

I am using nokogiri to screen scrape some HTML. In some occurrences, I am getting some weird characters back, I have tracked down the ASCII code for these characters with the following code:

  @parser.leads[0].phone_numbers[0].each_byte  do |c|
    puts "char=#{c}"
  end

The characters in question have an ASCII code of 194 and 160.

I want to somehow strip these characters out while parsing.

I have tried the following code but it does not work.

@parser.leads[0].phone_numbers[0].gsub(/160.chr/,'').gsub(/194.chr/,'')

Can anyone tell me how to achieve this?

5 Answers
Related