module Protocol::HTTP::URL

def self.escape(string, encoding = string.encoding)

Escapes a generic string, using percent encoding.
def self.escape(string, encoding = string.encoding)
	string.b.gsub(/([^a-zA-Z0-9_.\-]+)/) do |m|
		'%' + m.unpack('H2' * m.bytesize).join('%').upcase
	end.force_encoding(encoding)
end