ライブラリ
クラス
-
ARGF
. class (33) - Encoding (11)
-
Encoding
:: Converter (33) - IO (77)
-
Net
:: IMAP (22) - String (146)
- StringScanner (55)
- Symbol (19)
モジュール
- Base64 (33)
-
CGI
:: HtmlExtension (22) - Digest (11)
-
ERB
:: Util (22) -
JSON
:: Generator :: GeneratorMethods :: String (11) - Kconv (11)
-
RSS
:: ContentModel (22) - URI (58)
キーワード
- CompatibilityError (11)
- Converter (11)
- ConverterNotFoundError (11)
- EncodeError (11)
- InvalidByteSequenceError (11)
- Marshal フォーマット (11)
-
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 2
. 1 . 0 (11) -
NEWS for Ruby 2
. 3 . 0 (9) - NKF (11)
- String (11)
- UndefinedConversionError (11)
- base64 (11)
- casecmp (22)
- casecmp? (16)
-
content
_ encoded (11) -
content
_ encoded= (11) -
decode
_ utf7 (11) -
decode
_ www _ form (11) -
decode
_ www _ form _ component (11) -
default
_ internal (11) -
each
_ codepoint (22) - encode! (22)
- encode64 (11)
-
encode
_ utf7 (11) -
encode
_ www _ form (11) -
encode
_ www _ form _ component (11) - encoding (11)
- escape (7)
-
for
_ fd (11) - form (22)
-
get
_ byte (11) - getbyte (11)
- getch (11)
- hexencode (11)
- match? (11)
-
matched
_ size (11) - new (72)
- open (22)
-
ruby 1
. 8 . 3 feature (11) -
set
_ encoding (66) -
strict
_ encode64 (11) -
to
_ json _ raw _ object (11) - tolocale (22)
- u (11)
-
url
_ encode (11) -
urlsafe
_ encode64 (11) - 多言語化 (11)
- 正規表現 (11)
検索結果
先頭5件
-
String
# encode(**options) -> String (18127.0) -
self を指定したエンコーディングに変換した文字列を作成して返します。引数 を2つ与えた場合、第二引数は変換元のエンコーディングを意味します。さもな くば self のエンコーディングが使われます。 無引数の場合は、Encoding.default_internal が nil でなければそれが変換先のエンコーディングになり、かつ :invalid => :replace と :undef => :replace が指定されたと見なされ、nil ならば変換は行われません。
...= "いろは"
s.encode("EUC-JP")
s.encode(Encoding::UTF_8)
# U+00B7 MIDDLE DOT, U+2014 EM DASH は対応する文字が Windows-31J には
# 存在しないのでそのまま変換しようとすると Encoding::UndefinedConversionError が発生する
str = "\u00b7\u2014"
str.encode("Windows-31J",......fallback: { "\u00b7" => "\xA5".force_encoding("Windows-31J"),
"\u2014" => "\x81\x5C".force_encoding("Windows-31J") })
//}
@see String#encode!... -
String
# encode(encoding , **options) -> String (18127.0) -
self を指定したエンコーディングに変換した文字列を作成して返します。引数 を2つ与えた場合、第二引数は変換元のエンコーディングを意味します。さもな くば self のエンコーディングが使われます。 無引数の場合は、Encoding.default_internal が nil でなければそれが変換先のエンコーディングになり、かつ :invalid => :replace と :undef => :replace が指定されたと見なされ、nil ならば変換は行われません。
...= "いろは"
s.encode("EUC-JP")
s.encode(Encoding::UTF_8)
# U+00B7 MIDDLE DOT, U+2014 EM DASH は対応する文字が Windows-31J には
# 存在しないのでそのまま変換しようとすると Encoding::UndefinedConversionError が発生する
str = "\u00b7\u2014"
str.encode("Windows-31J",......fallback: { "\u00b7" => "\xA5".force_encoding("Windows-31J"),
"\u2014" => "\x81\x5C".force_encoding("Windows-31J") })
//}
@see String#encode!... -
String
# encode(encoding , from _ encoding , **options) -> String (18127.0) -
self を指定したエンコーディングに変換した文字列を作成して返します。引数 を2つ与えた場合、第二引数は変換元のエンコーディングを意味します。さもな くば self のエンコーディングが使われます。 無引数の場合は、Encoding.default_internal が nil でなければそれが変換先のエンコーディングになり、かつ :invalid => :replace と :undef => :replace が指定されたと見なされ、nil ならば変換は行われません。
...= "いろは"
s.encode("EUC-JP")
s.encode(Encoding::UTF_8)
# U+00B7 MIDDLE DOT, U+2014 EM DASH は対応する文字が Windows-31J には
# 存在しないのでそのまま変換しようとすると Encoding::UndefinedConversionError が発生する
str = "\u00b7\u2014"
str.encode("Windows-31J",......fallback: { "\u00b7" => "\xA5".force_encoding("Windows-31J"),
"\u2014" => "\x81\x5C".force_encoding("Windows-31J") })
//}
@see String#encode!... -
URI
. encode(str , unsafe = URI :: UNSAFE) -> String (18113.0) -
URI 文字列をエンコードした文字列を返します。
...RI 文字列をエンコードした文字列を返します。
このメソッドは obsolete です。
代わりに
ERB::Util.#url_encode,
CGI.escape,
URI.encode_www_form_component,
WEBrick::HTTPUtils.#escape_form,
WEBrick::HTTPUtils.#escape
などの使用を検討してください。
詳細... -
URI
. encode _ www _ form(enum , enc=nil) -> String (6125.0) -
enum から URL-encoded form data を生成します。
...RL-encoded form data を生成します。
HTML5 で定義されている application/x-www-form-urlencoded 形式の
文字列を生成します。
enum には通常 [key, value] という形の配列の配列を渡します。
以下の例を見てください。
require 'uri'
URI.encode_ww......[key, value] の形のデータを渡すものであれば
何でも渡すことができます(例えば Hash など)。
require 'uri'
URI.encode_www_form({"a"=>"1", "b"=>"2", "c"=>"x yz"})
# => "a=1&b=2&c=x+yz"
このメソッドは引数のエンコーディングを変換しません。......ソッドを使うべきではありません。
このメソッドは内部的に
URI.encode_www_form_component
を使っています。
このメソッドは
https://url.spec.whatwg.org/#concept-urlencoded-serializer
にもとづいて実装されています。
@param enum エンコードす... -
String
# encode!(encoding , from _ encoding , options = nil) -> self (6120.0) -
self を指定したエンコーディングに変換し、自身を置き換えます。引数を2つ 与えた場合、第二引数は変換元のエンコーディングを意味します。さもなくば self のエンコーディングが使われます。変換後の self を返します。
...す。
@param from_encoding 変換元のエンコーディングを表す文字列か Encoding オブジェクトを指定します。
@return 変換後のself
//emlist[例][ruby]{
#coding:UTF-8
s = "いろは"
s.encode!("EUC-JP")
s.encode!(Encoding::UTF_8)
//}
@see String#encode... -
String
# encode!(encoding , options = nil) -> self (6120.0) -
self を指定したエンコーディングに変換し、自身を置き換えます。引数を2つ 与えた場合、第二引数は変換元のエンコーディングを意味します。さもなくば self のエンコーディングが使われます。変換後の self を返します。
...す。
@param from_encoding 変換元のエンコーディングを表す文字列か Encoding オブジェクトを指定します。
@return 変換後のself
//emlist[例][ruby]{
#coding:UTF-8
s = "いろは"
s.encode!("EUC-JP")
s.encode!(Encoding::UTF_8)
//}
@see String#encode... -
URI
. encode _ www _ form _ component(str , enc=nil) -> String (6119.0) -
文字列を URL-encoded form data の1コンポーネント としてエンコードした文字列を返します。
...文字列を URL-encoded form data の1コンポーネント
としてエンコードした文字列を返します。
通常は URI.encode_www_form を使うほうがよいでしょう。
このメソッドでは *, -, ., 0-9, A-Z, _, a-z, は変換せず、
空白は + に変換し、その他......します。
このメソッドは
https://www.w3.org/TR/2013/CR-html5-20130806/forms.html#url-encoded-form-data
にもとづいて実装されています。
//emlist[][ruby]{
require 'uri'
p URI.encode_www_form_component('Ruby リファレンスマニュアル')
# => "Ruby+%E3%83%AA%E3%83%95%E3%......%83%B3%E3%82%B9%E3%83%9E%E3%83%8B%E3%83%A5%E3%82%A2%E3%83%AB"
//}
@param str エンコードする文字列
@param enc 指定された場合、パーセントエンコーディングする前に、strをこのエンコーディングに変換
@see URI.decode_www_form_component, URI.encode_www_form... -
Base64
. # urlsafe _ encode64(bin , padding: true) -> String (6113.0) -
与えられたデータを Base64 エンコードした文字列を返します。
...データを指定します。
@param padding false を指定した場合、 = によるパディングが行われなくなります。
//emlist[例][ruby]{
require 'base64'
p Base64.urlsafe_encode64('hoge')
# => "aG9nZQ=="
p Base64.urlsafe_encode64('hoge', padding: false)
# => "aG9nZQ"
//}... -
Base64
. # encode64(bin) -> String (6107.0) -
与えられたデータを Base64 エンコードした文字列を返します。
...字ごとに改行を追加します。
@param bin Base64 エンコードするデータを指定します。
require 'base64'
Base64.encode64("Now is the time for all good coders\nto learn Ruby")
# => Tm93IGlzIHRoZSB0aW1lIGZvciBhbGwgZ29vZCBjb2RlcnMKdG8gbGVhcm4g
# UnVieQ==...