# File lib/openid/yadis/xri.rb, line 34
      def self.escape_for_iri(xri)
        esc = xri.dup
        # encode all %
        esc.gsub!(/%/, '%25')
        esc.gsub!(/\((.*?)\)/) { |xref_match|
          xref_match.gsub(/[\/\?\#]/) { |char_match|
            CGI::escape(char_match)
          }
        }
        return esc
      end