diff --git a/lib/simpleidn.rb b/lib/simpleidn.rb index ad78fc5..86cda90 100644 --- a/lib/simpleidn.rb +++ b/lib/simpleidn.rb @@ -1,10 +1,6 @@ require 'simpleidn/version' require 'simpleidn/uts46mapping' - -# If no known method for normalization is available, load unf to get one -unless ''.respond_to?(:unicode_normalize) || ''.respond_to?(:to_nfc) - require 'unf' -end +require 'unf' module SimpleIDN # The ConversionError is raised when an error occurs during a @@ -227,9 +223,6 @@ def uts46map(str, transitional = false) mapped = str.codepoints.map { |cp| UTS64MAPPING.fetch(cp, cp) } mapped = mapped.map { |cp| TRANSITIONAL.fetch(cp, cp) } if transitional mapped = mapped.flatten.map { |cp| cp.chr(Encoding::UTF_8) }.join(EMPTY) - - # Prefer the internal method if available (e.g. Ruby 2.2 or later) - return mapped.unicode_normalize(:nfc) if mapped.respond_to? :unicode_normalize mapped.to_nfc end