66件ヒット
[1-66件を表示]
(0.050秒)
クラス
- IO (66)
キーワード
-
external
_ encoding (12) -
internal
_ encoding (12) -
set
_ encoding (36) -
set
_ encoding _ by _ bom (6)
検索結果
先頭5件
-
IO
# set _ encoding _ by _ bom -> Encoding | nil (6259.0) -
BOM から IO のエンコーディングを設定します。
...[例][ruby]{
File.write("bom.txt", "\u{FEFF}abc")
File.open("bom.txt", "rb") do |io|
p io.set_encoding_by_bom #=> #<Encoding:UTF-8>
str = io.read
p str #=> "abc"
p str.encoding #=> #<Encoding:UTF-8>
end
File.write("nobom.txt", "abc")
File.open("nobom.......txt", "rb") do |io|
p io.set_encoding_by_bom #=> nil
end
//}... -
IO
# external _ encoding -> Encoding | nil (6239.0) -
IO の外部エンコーディングを返します。 外部エンコーディングが指定されていない場合は nil を返します。 ただし読み込み専用モードの場合は Encoding.default_external になります。
...ディングが指定されていない場合は nil を返します。
ただし読み込み専用モードの場合は Encoding.default_external になります。
//emlist[例][ruby]{
IO.write("testfile", "abcde")
File.open("testfile") { |f| p f.external_encoding } # => #<Encoding:UTF-8>
//}... -
IO
# internal _ encoding -> Encoding | nil (6235.0) -
IO の内部エンコーディングを返します。 内部エンコーディングが指定されていない場合は nil を返します。
...エンコーディングが指定されていない場合は nil を返します。
//emlist[例][ruby]{
IO.write("testfile", "abcde")
File.open("testfile") do |f|
p f.internal_encoding # => nil
f.set_encoding("ASCII-8BIT", "EUC-JP")
p f.internal_encoding # => #<Encoding:EUC-JP>
end
//}... -
IO
# set _ encoding(enc _ str , **opts) -> self (6136.0) -
IO のエンコーディングを設定します。
...文字列か Encoding オブジェクトを指定します。
@param int_enc 内部エンコーディングを表す文字列か Encoding オブジェクトを指定します。
@param opts エンコーディング変換のオプション
例:
io = File.open(file)
io.set_encoding("ASCII-8BI... -
IO
# set _ encoding(ext _ enc) -> self (6136.0) -
IO のエンコーディングを設定します。
...文字列か Encoding オブジェクトを指定します。
@param int_enc 内部エンコーディングを表す文字列か Encoding オブジェクトを指定します。
@param opts エンコーディング変換のオプション
例:
io = File.open(file)
io.set_encoding("ASCII-8BI... -
IO
# set _ encoding(ext _ enc , int _ enc , **opts) -> self (6136.0) -
IO のエンコーディングを設定します。
...文字列か Encoding オブジェクトを指定します。
@param int_enc 内部エンコーディングを表す文字列か Encoding オブジェクトを指定します。
@param opts エンコーディング変換のオプション
例:
io = File.open(file)
io.set_encoding("ASCII-8BI...