lib/addressable/idna/pure.rb in addressable-2.3.3 vs lib/addressable/idna/pure.rb in addressable-2.3.4

- old
+ new

@@ -104,10 +104,11 @@ output end # Unicode normalization form KC. def self.unicode_normalize_kc(input) + input = input.to_s unless input.is_a?(String) unpacked = input.unpack("U*") unpacked = unicode_compose(unicode_sort_canonical(unicode_decompose(unpacked))) return unpacked.pack("U*") end @@ -315,13 +316,23 @@ UNICODE_DATA_COMPATIBILITY = 3 UNICODE_DATA_UPPERCASE = 4 UNICODE_DATA_LOWERCASE = 5 UNICODE_DATA_TITLECASE = 6 - # This is a sparse Unicode table. Codepoints without entries are - # assumed to have the value: [0, 0, nil, nil, nil, nil, nil] - UNICODE_DATA = File.open(UNICODE_TABLE, "rb") do |file| - Marshal.load(file.read) + begin + if defined?(FakeFS) + fakefs_state = FakeFS.activated? + FakeFS.deactivate! + end + # This is a sparse Unicode table. Codepoints without entries are + # assumed to have the value: [0, 0, nil, nil, nil, nil, nil] + UNICODE_DATA = File.open(UNICODE_TABLE, "rb") do |file| + Marshal.load(file.read) + end + ensure + if defined?(FakeFS) + FakeFS.activate! if fakefs_state + end end COMPOSITION_TABLE = {} for codepoint, data in UNICODE_DATA canonical = data[UNICODE_DATA_CANONICAL]