title: Convert encoded string containg \x characters to JSON
body: <p>I am trying to convert to JSON, a string that contains backslash x encoded character</p>
  
  <pre><code>data = "{\"schema\":\"iglu\", \"data\": \"hellox\E2\x80\x99s\"}"
  data.to_json
  </code></pre>
  
  <p>However I get the following error:
  JSON::GeneratorError: source sequence is illegal/malformed utf-8
  from /Users/user1/.rvm/gems/ruby-2.5.5@tagtrue/gems/activesupport-4.2.11.1/lib/active_support/core_ext/object/json.rb:34:in `to_json'
  Caused by Encoding::UndefinedConversionError: "\xE2" from ASCII-8BIT to UTF-8</p>
  
  <p>How can I get to_json to pass on data?</p>