vcr/vcr — pull request #438 by huoxito (2014-10-06 03:18:54+00:00)
Title: Add configuration for forcing utf8 on request / response body

Hi!

I've been working with an api that responds with xml data in portuguese. So we have words like "integração" in the response / request body and while data was flowing properly VCR would record only binary data.

Recording as is:

```yaml
encoding: ASCII-8BIT
string: !binary |-
w6kgw6kgw6kgw6kgw6kgw6kgw6kgw6kgw6kgw6k=
```

Forcing utf-8:

```yaml
body:
encoding: utf-8
string: "é é é é é é é é é é"
```

```ruby
VCR.use_cassette "check" do
Net::HTTP.get_response(URI('http://putsreq.herokuapp.com/OXez967BIxgGkizxff4R'))
end
```

While inspecting VCR internals I noticed that it sets the encoding flag of the body based on the `body.encoding` itself and somehow ruby (not sure if VCR or Webmock?) is setting the body encoding as ASCII-8BIT probably due to strings like "integra\xC3\xA7\xC3\xA3o" when what we really want is utf-8.

There's a good chance I'm changing code in the wrong place but this is what I could come up with so far. Would forcing utf8 on body make sense for those scenarios? I'll try to look further to figure where exactly the body gets messy.