Only detect encoding if the Ruby supports it