title: Ruby removing whitespace?
body: <p>Having some issues removing <code>&amp;nbsp;</code> whitespace.</p>
  
  <pre><code>vehicle = [" 2013 ", "BMW ", "535 ", "Sedan 4 Door "] 
  v = vehicle[0]
  # =&gt; " 2013 "
  
  v[-1].ord.chr
  # =&gt; "\xA0"
  </code></pre>
  
  <p>Failed Attempts:</p>
  
  <pre><code>vehicle.map { |d| d.gsub(/\S(\w*)/, '\1') }
  # =&gt; ["2013", "MW", "35", "edan  oor"] (space gone but so are other characters.)
  
  vehicle.map { |d| d.gsub(/\xA0/, '') }
  # =&gt; SyntaxError: (irb):340: invalid multibyte escape: /\xA0/
  
  vehicle.map { |d| d.gsub(/#{160.chr}/, '') }
  # =&gt; Encoding::CompatibilityError: incompatible encoding regexp match (ASCII-8BIT regexp with UTF-8 string)
  </code></pre>
  
  <p>Answer from <a href="https://stackoverflow.com/questions/3913900/ruby-1-9-strip-not-removing-whitespace/4201783">this question</a> works:</p>
  
  <pre><code>vehicle.map { |d| d.gsub("\302\240", ' ').strip }
  # =&gt; ["2013", "BMW", "535", "Sedan 4 Door"] 
  </code></pre>
  
  <p>but it doesn't explain why/how. Can someone explain how and why this works? Or suggest an alternative?</p>