Module: URITemplate::Utils::StringEncoding
- Included in:
- URITemplate::Utils, Escaping::EscapeUtils, Escaping::Pure
- Defined in:
- lib/uri_template/utils.rb
Overview
Bundles some string encoding methods.
Instance Method Summary (collapse)
-
- (Object) force_utf8(str)
enforces UTF8 encoding.
-
- (Object) force_utf8_encode(str)
enforces UTF8 encoding.
- - (Object) force_utf8_fallback(str)
-
- (Object) to_ascii(string)
converts a string to ascii.
-
- (Object) to_ascii_encode(str)
converts a string to ascii.
- - (Object) to_ascii_fallback(str)
-
- (Object) to_utf8(string)
converts a string to utf8.
-
- (Object) to_utf8_encode(str)
converts a string to utf8.
- - (Object) to_utf8_fallback(str)
Instance Method Details
- (Object) force_utf8(str)
enforces UTF8 encoding
112 113 114 115 116 |
# File 'lib/uri_template/utils.rb', line 112 def force_utf8_encode(str) return str if str.encoding == Encoding::UTF_8 str = str.dup if str.frozen? return str.force_encoding(Encoding::UTF_8) end |
- (Object) force_utf8_encode(str)
enforces UTF8 encoding
112 113 114 115 116 |
# File 'lib/uri_template/utils.rb', line 112 def force_utf8_encode(str) return str if str.encoding == Encoding::UTF_8 str = str.dup if str.frozen? return str.force_encoding(Encoding::UTF_8) end |
- (Object) force_utf8_fallback(str)
127 128 129 |
# File 'lib/uri_template/utils.rb', line 127 def force_utf8_fallback(str) str end |
- (Object) to_ascii(string)
converts a string to ascii
92 93 94 |
# File 'lib/uri_template/utils.rb', line 92 def to_ascii_encode(str) str.encode(Encoding::ASCII) end |
- (Object) to_ascii_encode(str)
converts a string to ascii
92 93 94 |
# File 'lib/uri_template/utils.rb', line 92 def to_ascii_encode(str) str.encode(Encoding::ASCII) end |
- (Object) to_ascii_fallback(str)
119 120 121 |
# File 'lib/uri_template/utils.rb', line 119 def to_ascii_fallback(str) str end |
- (Object) to_utf8(string)
converts a string to utf8
102 103 104 |
# File 'lib/uri_template/utils.rb', line 102 def to_utf8_encode(str) str.encode(Encoding::UTF_8) end |
- (Object) to_utf8_encode(str)
converts a string to utf8
102 103 104 |
# File 'lib/uri_template/utils.rb', line 102 def to_utf8_encode(str) str.encode(Encoding::UTF_8) end |
- (Object) to_utf8_fallback(str)
123 124 125 |
# File 'lib/uri_template/utils.rb', line 123 def to_utf8_fallback(str) str end |