def normalized_path
@normalized_path ||= (begin
begin
result = Addressable::URI.encode_component(
Addressable::IDNA.unicode_normalize_kc(
Addressable::URI.unencode_component(self.path.strip)),
Addressable::URI::CharacterClasses::PATH
)
rescue ArgumentError
result = Addressable::URI.encode_component(
Addressable::URI.unencode_component(self.path.strip),
Addressable::URI::CharacterClasses::PATH
)
end
result = self.class.normalize_path(result)
if result == "" &&
["http", "https", "ftp", "tftp"].include?(self.normalized_scheme)
result = "/"
end
result
end)
end