Ignore encoding test on Ruby 1.8.7

Use the same defined?(Encoding) check as JsonCoder uses to determine
whether we are able to pass in invalid Json.