るりまサーチ (Ruby 2.1.0)

最速Rubyリファレンスマニュアル検索!
9件ヒット [1-9件を表示] (0.084秒)

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

検索結果

String#encode(**options) -> String (78400.0)

self を指定したエンコーディングに変換した文字列を作成して返します。引数 を2つ与えた場合、第二引数は変換元のエンコーディングを意味します。さもな くば self のエンコーディングが使われます。 無引数の場合は、Encoding.default_internal が nil でなければそれが変換先のエンコーディングになり、かつ :invalid => :replace と :undef => :replace が指定されたと見なされ、nil ならば変換は行われません。

self を指定したエンコーディングに変換した文字列を作成して返します。引数
を2つ与えた場合、第二引数は変換元のエンコーディングを意味します。さもな
くば self のエンコーディングが使われます。
無引数の場合は、Encoding.default_internal が nil でなければそれが変換先のエンコーディングになり、かつ :invalid => :replace と :undef => :replace が指定されたと見なされ、nil ならば変換は行われません。

@param encoding 変換先のエンコーディングを表す文字列か Encoding オブジェクトを...

String#encode(encoding, **options) -> String (78400.0)

self を指定したエンコーディングに変換した文字列を作成して返します。引数 を2つ与えた場合、第二引数は変換元のエンコーディングを意味します。さもな くば self のエンコーディングが使われます。 無引数の場合は、Encoding.default_internal が nil でなければそれが変換先のエンコーディングになり、かつ :invalid => :replace と :undef => :replace が指定されたと見なされ、nil ならば変換は行われません。

self を指定したエンコーディングに変換した文字列を作成して返します。引数
を2つ与えた場合、第二引数は変換元のエンコーディングを意味します。さもな
くば self のエンコーディングが使われます。
無引数の場合は、Encoding.default_internal が nil でなければそれが変換先のエンコーディングになり、かつ :invalid => :replace と :undef => :replace が指定されたと見なされ、nil ならば変換は行われません。

@param encoding 変換先のエンコーディングを表す文字列か Encoding オブジェクトを...

String#encode(encoding, from_encoding, **options) -> String (78400.0)

self を指定したエンコーディングに変換した文字列を作成して返します。引数 を2つ与えた場合、第二引数は変換元のエンコーディングを意味します。さもな くば self のエンコーディングが使われます。 無引数の場合は、Encoding.default_internal が nil でなければそれが変換先のエンコーディングになり、かつ :invalid => :replace と :undef => :replace が指定されたと見なされ、nil ならば変換は行われません。

self を指定したエンコーディングに変換した文字列を作成して返します。引数
を2つ与えた場合、第二引数は変換元のエンコーディングを意味します。さもな
くば self のエンコーディングが使われます。
無引数の場合は、Encoding.default_internal が nil でなければそれが変換先のエンコーディングになり、かつ :invalid => :replace と :undef => :replace が指定されたと見なされ、nil ならば変換は行われません。

@param encoding 変換先のエンコーディングを表す文字列か Encoding オブジェクトを...

Encoding::Converter (42055.0)

文字エンコーディング(文字符号化方式)の変換器のクラスです。既存の変換器より一段細かな処理が可能となります。

文字エンコーディング(文字符号化方式)の変換器のクラスです。既存の変換器より一段細かな処理が可能となります。

Encoding::Converter を用いて変換を行う場合は、Encoding::Converter#convert か、より細かな変換処理が可能な Encoding::Converter#primitive_convert が利用できます。
エンコーディングを変換するメソッドはこの他に String#encode, NKF.#nkf
などがあります。

Encoding::ConverterNotFoundError (42019.0)

指定した名前のエンコーディング変換をする変換器が 存在しない場合に発生する例外。

指定した名前のエンコーディング変換をする変換器が
存在しない場合に発生する例外。

//emlist[例][ruby]{
"あ".encode("Foo")
#=> Encoding::ConverterNotFoundError: code converter not found (UTF-8 to Foo)
//}

絞り込み条件を変える

Encoding::Converter.new(convpath) -> Encoding::Converter (33319.0)

Encoding::Converter オブジェクトを作成します。

Encoding::Converter オブジェクトを作成します。

@param source_encoding 変換元のエンコーディング
@param destination_encoding 変換先のエンコーディング
@param options 変換の詳細を指定する定数やハッシュ
@param convpath 変換経路の配列

options では String#encode でのハッシュオプションに加えて、以下の定数が利用可能です。

* Encoding::Converter::INVALID_REPLACE
* Encoding::Converter::UNDEF_RE...

Encoding::Converter.new(source_encoding, destination_encoding) -> Encoding::Converter (33319.0)

Encoding::Converter オブジェクトを作成します。

Encoding::Converter オブジェクトを作成します。

@param source_encoding 変換元のエンコーディング
@param destination_encoding 変換先のエンコーディング
@param options 変換の詳細を指定する定数やハッシュ
@param convpath 変換経路の配列

options では String#encode でのハッシュオプションに加えて、以下の定数が利用可能です。

* Encoding::Converter::INVALID_REPLACE
* Encoding::Converter::UNDEF_RE...

Encoding::Converter.new(source_encoding, destination_encoding, options) -> Encoding::Converter (33319.0)

Encoding::Converter オブジェクトを作成します。

Encoding::Converter オブジェクトを作成します。

@param source_encoding 変換元のエンコーディング
@param destination_encoding 変換先のエンコーディング
@param options 変換の詳細を指定する定数やハッシュ
@param convpath 変換経路の配列

options では String#encode でのハッシュオプションに加えて、以下の定数が利用可能です。

* Encoding::Converter::INVALID_REPLACE
* Encoding::Converter::UNDEF_RE...

Encoding::UndefinedConversionError (24037.0)

エンコーディング変換後の文字が存在しない場合に発生する例外。

エンコーディング変換後の文字が存在しない場合に発生する例外。

UTF-8 にしかない文字を EUC-JP に変換しようとした場合などに発生します。

//emlist[例][ruby]{
"\u2603".encode(Encoding::EUC_JP)
#=> Encoding::UndefinedConversionError: U+2603 from UTF-8 to EUC-JP
//}


変換が多段階でなされ、その途中で例外が生じた場合は、
例外オブジェクトが保持するエラー情報はその中間のものになります。

//emlist[例][ruby]{
ec = Encoding::Co...