heroku/heroku — pull request #349 by dblock (2012-06-01 20:19:23+00:00)
Title: A better fix for #346.

The `data.class.method_defined?(:force_encoding)` call will return a false positive if you have, for example, a private `:force_encoding` method. The standard ruby way to fix this seems to see if `data.respond_to?`.

``` ruby
ruby-1.8.7-p352 :002 > "".respond_to?(:force_encoding)
=> false
```

``` ruby
ruby-1.9.2-p290 :002 > "".respond_to?(:force_encoding)
=> true
```