結局、Encoding関連で今まで出た案をまとめると

1. RUBY_VERSIONで分岐
2. defined?(::Encoding)
3. str.respond_to?(:force_encoding)

あたりが現実的な解か