Module: UTF8Encoding::ForceBinary
- Included in:
- UTF8Encoding
- Defined in:
- lib/ndr_support/utf8_encoding/force_binary.rb
Overview
Allows any supported object to have any high-ascii string content to be force-encoded from UTF-8 to BINARY (/ASCII-8BIT). This ensures that any serialisation to YAML, using Psych, can be stored in other encodings. (Psych by default emits UTF-8 YAML, which might not survive being stored in a Windows-1252 database, for example.)
Instance Method Summary collapse
-
#binary_encode_any_high_ascii(object) ⇒ Object
Recursively ensure the correct encoding is being used:.
Instance Method Details
#binary_encode_any_high_ascii(object) ⇒ Object
Recursively ensure the correct encoding is being used:
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/ndr_support/utf8_encoding/force_binary.rb', line 10 def binary_encode_any_high_ascii(object) case object when String binary_encode_if_any_high_ascii(object) when Hash binary_encode_any_high_ascii_in_hash(object) when Array binary_encode_any_high_ascii_in_array(object) else object end end |