title: Unable to parse JSON because of invisible characters
body: <p>I get an error with this code:</p>
  
  <pre><code>require 'net/http'
  require 'rubygems'
  require 'json'
  
  puts "test1:"
  url = "http://thomas.joulin.eu/a.json"
  resp = Net::HTTP.get_response(URI.parse(url))
  data = resp.body
  result = JSON.parse(data)
  puts result
  
  puts "test2:"
  url = "http://thomas.joulin.eu/b.json"
  resp = Net::HTTP.get_response(URI.parse(url))
  data = resp.body
  result = JSON.parse(data)
  puts result
  </code></pre>
  
  <p>Response:</p>
  
  <pre><code>test1:
  {"k"=&gt;"v"}
  test2:
   (JSON::ParserError).0.0/gems/json-1.8.1/lib/json/common.rb:155:in `parse': 757: unexpected token at '﻿{ "k": "v" }
  '
      from /Library/Ruby/Gems/2.0.0/gems/json-1.8.1/lib/json/common.rb:155:in `parse'
      from test.rb:16:in `&lt;main&gt;'
  </code></pre>
  
  <p>I'm pretty sure it's because of invisible chacters, but <code>strip</code> or <code>delete!("\r")</code> didn't help.</p>
  
  <p><code>cat -e a.json</code></p>
  
  <pre><code>{ "k": "v" }%  
  </code></pre>
  
  <p><code>cat -e b.json</code></p>
  
  <pre><code>{ "k": "v" }^M$
  </code></pre>