class ICU::ConverterSelector
- ICU::ConverterSelector
- Reference
- Object
Overview
Converter Selector
Given a list of candidate converters, determines which ones can encode a particular string without data loss.
Usage
sel = ICU::ConverterSelector.new(["ISO-8859-1", "ISO-8859-2", "UTF-8"])
sel.select_for("Hello") # => ["ISO-8859-1", "ISO-8859-2", "UTF-8"]
sel.select_for("Héllo") # => ["ISO-8859-1", "UTF-8"]
See also
Defined in:
icu/converter.crConstructors
-
.new(converters : Array(String))
Creates a selector that will test the given list of converter names.
Instance Method Summary
- #finalize
-
#select_for(text : String) : Array(String)
Returns the names of all converters (from the list passed at construction) that can encode the given UTF-8 text without data loss.
- #to_unsafe : LibICU::UConverterSelector
Constructor Detail
Creates a selector that will test the given list of converter names.
converters is an array of encoding names (canonical names or aliases).
Raises ICU::Error if any converter name is unknown.
ICU::ConverterSelector.new(["UTF-8", "ISO-8859-1"])
Instance Method Detail
Returns the names of all converters (from the list passed at construction) that can encode the given UTF-8 text without data loss.
sel = ICU::ConverterSelector.new(["ISO-8859-1", "ISO-8859-2", "UTF-8"])
sel.select_for("Hello") # => ["ISO-8859-1", "ISO-8859-2", "UTF-8"]