るりまサーチ (Ruby 2.1.0)

最速Rubyリファレンスマニュアル検索!
1件ヒット [1-1件を表示] (0.037秒)
トップページ > ライブラリ:ビルトイン[x] > クエリ:ASCII[x] > クエリ:force_encoding[x] > バージョン:2.1.0[x] > クラス:Encoding[x]

別のキーワード

  1. csv force_quotes?
  2. string force_encoding
  3. _builtin force_encoding
  4. options force_update
  5. lazy force

検索結果

Encoding.compatible?(obj1, obj2) -> Encoding | nil (82.0)

2つのオブジェクトのエンコーディングに関する互換性をチェックします。 互換性がある場合はそのエンコーディングを、 ない場合は nil を返します。

...列が取るであろう Encoding オブジェクトを返します。

//emlist[例][ruby]{
Encoding
.compatible?("\xa1".force_encoding("iso-8859-1"), "b")
#=> #<Encoding:ISO-8859-1>

Encoding
.compatible?(
"\xa1".force_encoding("iso-8859-1"),
"\xa1\xa1".force_encoding("euc-jp"))
#=> nil
//}

...
...両方のオブジェクトが encoding を持つ場合には
互換性を判定することができます。
//emlist[例][ruby]{
Encoding
.compatible?(Encoding::UTF_8, Encoding::CP932)
# => nil
Encoding
.compatible?(Encoding::UTF_8, Encoding::US_ASCII)
# => #<Encoding:UTF-8>
//}
@param obj1 チェ...