るりまサーチ

最速Rubyリファレンスマニュアル検索!
132件ヒット [1-100件を表示] (0.042秒)
トップページ > クエリ:Encoding::UndefinedConversionError[x]

別のキーワード

  1. stringio set_encoding
  2. _builtin set_encoding
  3. _builtin encoding
  4. rss encoding
  5. rss encoding=

検索結果

<< 1 2 > >>

Encoding::UndefinedConversionError (23012.0)

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

...を EUC-JP に変換しようとした場合などに発生します。

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


変換が多段階でなされ、その途中で例外が生じた場合は、
例外オブジェ...
...# ISO-8859-1 -> UTF-8 -> EUC-JP
begin
ec.convert("\xa0")
# NO-BREAK SPACE, which is available in UTF-8 but not in EUC-JP.
rescue Encoding::UndefinedConversionError
p $!.source_encoding #=> #<Encoding:UTF-8>
p $!.destination_encoding #=> #<Encoding:EUC-JP>
p $!.source_...

Encoding::UndefinedConversionError#destination_encoding -> Encoding (21006.0)

エラーを発生させた変換の変換先のエンコーディングを Encoding オブジェクトで返します。

...エラーを発生させた変換の変換先のエンコーディングを Encoding
オブジェクトで返します。

@see Encoding::UndefinedConversionError#source_encoding...

Encoding::UndefinedConversionError#destination_encoding_name -> String (21006.0)

エラーを発生させた変換の変換先のエンコーディングを文字列で返します。

...エラーを発生させた変換の変換先のエンコーディングを文字列で返します。

@see Encoding::UndefinedConversionError#destination_encoding...

Encoding::UndefinedConversionError#error_char -> String (21006.0)

エラーを発生させた1文字を文字列で返します。

...エラーを発生させた1文字を文字列で返します。

//emlist[例][ruby]{
ec = Encoding::Converter.new("UTF-8", "EUC-JP")
begin
ec.convert("\u{a0}")
rescue Encoding::UndefinedConversionError
puts $!.error_char.dump #=> "\u{a0}"
end
//}...

Encoding::UndefinedConversionError#source_encoding -> Encoding (21006.0)

エラーを発生させた変換の変換元のエンコーディングを Encoding オブジェクトで返します。

...ーディングを Encoding
オブジェクトで返します。

変換が多段階になされる場合は元の文字列のものではない
エンコーディングが返される場合があることに注意してください。

@see Encoding::UndefinedConversionError#destination_encoding...

絞り込み条件を変える

Encoding::UndefinedConversionError#source_encoding_name -> Encoding (21006.0)

エラーを発生させた変換の変換元のエンコーディングを文字列で返します。

...エラーを発生させた変換の変換元のエンコーディングを文字列で返します。

@see Encoding::UndefinedConversionError#source_encoding...

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

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

...換えます。
: :undef => nil
変換先のエンコーディングにおいて文字が定義されていない場合に、例外 Encoding::UndefinedConversionError を投げます。(デフォルト)
: :undef => :replace
変換先のエンコーディングにおいて文字が定義されて...
...MIDDLE DOT, U+2014 EM DASH は対応する文字が Windows-31J には
# 存在しないのでそのまま変換しようとすると Encoding::UndefinedConversionError が発生する
str = "\u00b7\u2014"
str.encode("Windows-31J", fallback: { "\u00b7" => "\xA5".force_encoding("Windows-31J"),...

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

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

...換えます。
: :undef => nil
変換先のエンコーディングにおいて文字が定義されていない場合に、例外 Encoding::UndefinedConversionError を投げます。(デフォルト)
: :undef => :replace
変換先のエンコーディングにおいて文字が定義されて...
...MIDDLE DOT, U+2014 EM DASH は対応する文字が Windows-31J には
# 存在しないのでそのまま変換しようとすると Encoding::UndefinedConversionError が発生する
str = "\u00b7\u2014"
str.encode("Windows-31J", fallback: { "\u00b7" => "\xA5".force_encoding("Windows-31J"),...

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

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

...換えます。
: :undef => nil
変換先のエンコーディングにおいて文字が定義されていない場合に、例外 Encoding::UndefinedConversionError を投げます。(デフォルト)
: :undef => :replace
変換先のエンコーディングにおいて文字が定義されて...
...MIDDLE DOT, U+2014 EM DASH は対応する文字が Windows-31J には
# 存在しないのでそのまま変換しようとすると Encoding::UndefinedConversionError が発生する
str = "\u00b7\u2014"
str.encode("Windows-31J", fallback: { "\u00b7" => "\xA5".force_encoding("Windows-31J"),...

Encoding::Converter#convert(source_string) -> String (6.0)

与えられた文字列を変換して、変換できた結果を返します。 引数の末尾の文字がバイト列の途中で終わっている場合、そのバイト列は変換器内に取り置かれます。 変換を終了させるには Encoding::Converter#finish を呼びます。

...ByteSequenceError 変換元のエンコーディングにおいて不正なバイト列があった場合に発生します。
@raise Encoding::UndefinedConversionError 変換先のエンコーディングで未定義な文字があった場合に発生します。

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

絞り込み条件を変える

<< 1 2 > >>