274件ヒット
[1-100件を表示]
(0.111秒)
クラス
キーワード
- << (11)
-
ascii
_ compatible? (11) - asctime (11)
- b (11)
- chr (22)
- concat (19)
- ctime (11)
-
fixed
_ encoding? (11) -
force
_ encoding (11) - inspect (16)
-
internal
_ encoding (22) - pack (19)
- replacement (11)
- replacement= (11)
-
set
_ encoding (33) -
to
_ s (11) - unpack (11)
検索結果
先頭5件
-
Symbol
# encoding -> Encoding (18261.0) -
シンボルに対応する文字列のエンコーディング情報を表現した Encoding オブ ジェクトを返します。
...シンボルに対応する文字列のエンコーディング情報を表現した Encoding オブ
ジェクトを返します。
例:
# encoding: utf-8
:foo.encoding # => #<Encoding:US-ASCII>
:あかさたな.encoding # => #<Encoding:UTF-8>
@see String#encoding... -
Ripper
# encoding -> Encoding (18215.0) -
自身の持つ Ruby プログラムの文字エンコーディングを返します。
...自身の持つ Ruby プログラムの文字エンコーディングを返します。
Ruby プログラムの解析前は Encoding::US_ASCII を返します。... -
Encoding
# ascii _ compatible? -> bool (15142.0) -
自身が ASCII 互換のエンコーディングである場合真返します。 そうでない場合は偽を返します。
...自身が ASCII 互換のエンコーディングである場合真返します。
そうでない場合は偽を返します。
//emlist[例][ruby]{
Encoding::UTF_8.ascii_compatible? #=> true
Encoding::UTF_16BE.ascii_compatible? #=> false
//}... -
String
# force _ encoding(encoding) -> self (6279.0) -
文字列の持つエンコーディング情報を指定された encoding に変えます。
...情報を指定された encoding に変えます。
このとき実際のエンコーディングは変換されず、検査もされません。
Array#pack などで得られたバイト列のエンコーディングを指定する時に使います。
@param encoding 変更するエンコー......す文字列か Encoding オブジェクトを指定します。
//emlist[例][ruby]{
s = [164, 164, 164, 237, 164, 207].pack("C*")
p s.encoding #=> ASCII-8BIT
p s.force_encoding("EUC-JP") #=> "いろは"
p s.force_encoding(Encoding::EUC_JP)......#=> "いろは"
u = [12411, 12408, 12392].pack("U*")
u.force_encoding("UTF-8") #=> "ほへと"
u.force_encoding(Encoding::UTF_8) #=> "ほへと"
//}... -
ARGF
. class # internal _ encoding -> Encoding | nil (6269.0) -
ARGF から読み込んだ文字列の内部エンコーディングを返します。 内部エンコーディングが指定されていない場合は nil を返します。
... Encoding.default_external を返します。
ARGF.class#set_encoding で設定します。
例:
# $ ruby -Eutf-8 test.rb
# test.rb
ARGF.internal_encoding # => #<Encoding:UTF-8>
ARGF.set_encoding('utf-8','ascii')
ARGF.internal_encoding # => #<Encoding:US-ASCII>......例:
ARGF.binmode
ARGF.internal_encoding # => nil
@see IO, ARGF.class#external_encoding... -
IO
# internal _ encoding -> Encoding | nil (6233.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
//}... -
Regexp
# fixed _ encoding? -> bool (6226.0) -
正規表現が任意の ASCII 互換エンコーディングとマッチ可能な時に false を返します。
...が任意の ASCII 互換エンコーディングとマッチ可能な時に false を返します。
//emlist[例][ruby]{
# -*- coding:utf-8 -*-
r = /a/
r.fixed_encoding? # => false
r.encoding # => #<Encoding:US-ASCII>
r =~ "\u{66......# => 2
r =~ "\xa1\xa2 a".force_encoding("euc-jp") # => 2
r =~ "abc".force_encoding("euc-jp") # => 0
r = /a/u
r.fixed_encoding? # => true
r.encoding # => #<Encoding:UTF-8>
r =~ "\u{6666} a"......r =~ "\xa1\xa2".force_encoding("euc-jp")
rescue => e
e.class # => Encoding::CompatibilityError
end
r =~ "abc".force_encoding("euc-jp") # => 0
r = /\u{6666}/
r.fixed_encoding? # => true
r.encoding... -
IO
# set _ encoding(enc _ str , **opts) -> self (6128.0) -
IO のエンコーディングを設定します。
...列か Encoding オブジェクトを指定します。
@param int_enc 内部エンコーディングを表す文字列か Encoding オブジェクトを指定します。
@param opts エンコーディング変換のオプション
例:
io = File.open(file)
io.set_encoding("ASCII-8BIT", "E... -
IO
# set _ encoding(ext _ enc) -> self (6128.0) -
IO のエンコーディングを設定します。
...列か Encoding オブジェクトを指定します。
@param int_enc 内部エンコーディングを表す文字列か Encoding オブジェクトを指定します。
@param opts エンコーディング変換のオプション
例:
io = File.open(file)
io.set_encoding("ASCII-8BIT", "E... -
IO
# set _ encoding(ext _ enc , int _ enc , **opts) -> self (6128.0) -
IO のエンコーディングを設定します。
...列か Encoding オブジェクトを指定します。
@param int_enc 内部エンコーディングを表す文字列か Encoding オブジェクトを指定します。
@param opts エンコーディング変換のオプション
例:
io = File.open(file)
io.set_encoding("ASCII-8BIT", "E...