asciicompat_encoding

Encoding::Converter.asciicompat_encoding(string) â encoding or nil
Encoding::Converter.asciicompat_encoding(encoding) â encoding or nil
Class Public methods

Returns the corresponding ASCII compatible encoding.

Returns nil if the argument is an ASCII compatible encoding.

âcorresponding ASCII compatible encodingâ is an ASCII compatible encoding which can represents exactly the same characters as the given ASCII incompatible encoding. So, no conversion undefined error occurs when converting between the two encodings.

Encoding::Converter.asciicompat_encoding("ISO-2022-JP") #=> #<Encoding:stateless-ISO-2022-JP>
Encoding::Converter.asciicompat_encoding("UTF-16BE") #=> #<Encoding:UTF-8>
Encoding::Converter.asciicompat_encoding("UTF-8") #=> nil
doc_ruby_on_rails
2015-04-04 18:13:09
Comments
Leave a Comment

Please login to continue.