るりまサーチ

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

別のキーワード

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

ライブラリ

検索結果

<< 1 2 > >>

Encoding (6025.0)

文字エンコーディング(文字符号化方式)のクラスです。Rubyの多言語対応(M17N)機能において利用されます。

...ンコーディングによるものであるかも併せて保持しています。この情報は String#encoding により取得できます。 Encoding オブジェクトを返すメソッドにはこの他に IO#internal_encoding, IO#external_encoding などがあります。

@see spec/m17n...

CGI::InvalidEncoding (6001.0)

不正な文字エンコーディングが現れたときに発生する例外です。

不正な文字エンコーディングが現れたときに発生する例外です。

EncodingError (6001.0)

エンコーディング関連の例外の基底クラス。

エンコーディング関連の例外の基底クラス。

Encoding::UndefinedConversionError (3073.0)

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

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

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


変換が多段階でなされ、その途中で例外が生じた場合...
...e 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_name #=> "UTF-8"
p $!.destination_encoding_name #=> "EUC-JP"
puts $!.erro...
...r_char.dump #=> "\u{a0}"
p $!.error_char.encoding #=> #<Encoding:UTF-8>
end
//}...

Encoding::Converter (3019.0)

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

...す。既存の変換器より一段細かな処理が可能となります。

Encoding
::Converter を用いて変換を行う場合は、Encoding::Converter#convert か、より細かな変換処理が可能な Encoding::Converter#primitive_convert が利用できます。
エンコーディング...

絞り込み条件を変える

Encoding::InvalidByteSequenceError (3019.0)

文字列がそのエンコーディングにおいて不正なバイト列である場合に発生 する例外。

...である場合に発生
する例外。

通常エンコーディング変換時に発生します。

//emlist[例][ruby]{
"\x82\xa0".force_encoding("cp932").encode("UTF-8")
#=> "あ"
"\x82\xa0".force_encoding("EUC-JP").encode("UTF-8")
#=> Encoding::InvalidByteSequenceError: "\x82" on EUC-JP
//}...

Encoding::CompatibilityError (3007.0)

2つのエンコーディング間に互換性がない場合に発生する例外。

...い場合に発生する例外。

エンコーディングの異なる文字列を連結しようとした場合などに発生します。

//emlist[例][ruby]{
"あ".encode("EUC-JP") + "あ".encode("UTF-8")
#=> Encoding::CompatibilityError: incompatible character encodings: EUC-JP and UTF-8
//}...

Encoding::ConverterNotFoundError (3007.0)

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

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

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

IO (79.0)

基本的な入出力機能のためのクラスです。

...込みメソッドです。

テキスト読み込みメソッドは IO のエンコーディングの影響をうけます。
詳しくは「io_encoding」を参照して下さい。
以下がテキスト読み込みメソッドです。

* IO.foreach
* IO.readlines
* IO#each_line
* IO#lines
*...
...動作します。

例:

f = File.open('t.txt', 'r+:euc-jp')
p f.getc.encoding #=> Encoding::EUC_JP
p f.read(1).encoding #=> Encoding::ASCII_8BIT

====[a:io_encoding] IO のエンコーディングとエンコーディングの変換

IO...
...定されていない場合

IO からテキスト読み込みメソッドによって読み込まれた文字列のエンコーディングは Encoding.default_external
に設定されます。このとき実際の文字エンコーディングは検査されず、変換もされません。

:...
...込みメソッドです。

テキスト読み込みメソッドは IO のエンコーディングの影響をうけます。
詳しくは「io_encoding」を参照して下さい。
以下がテキスト読み込みメソッドです。

* IO.foreach
* IO.readlines
* IO#each_line
* IO#gets
*...

CSV (61.0)

このクラスは CSV ファイルやデータに対する完全なインターフェイスを提供します。

...parser works in the Encoding of the IO
or String object being read from or written to. Your data is never transcoded
(unless you ask Ruby to transcode it for you) and will literally be parsed in
the Encoding it is in. Thus CSV will return Arrays or Rows of Strings in the
Encoding
of your data. Th...
...is is accomplished by transcoding the parser itself
into your Encoding.

Some transcoding must take place, of course, to accomplish this multiencoding
support. For example, <tt>:col_sep</tt>, <tt>:row_sep</tt>, and
<tt>:quote_char</tt> must be transcoded to match your data. Hopefully this
makes th...
...just
magically work for you data. However, you can set these values manually in
the target Encoding to avoid the translation.

It's also important to note that while all of CSV's core parser is now
Encoding
agnostic, some features are not. For example, the built-in
converters will try to transcod...

絞り込み条件を変える

<< 1 2 > >>