Sha256: 4f8cfa1b87ab54c427842f858abe884f1e670b2a944742aeeec67647c7e1c155

Contents?: true

Size: 477 Bytes

Versions: 3

Compression:

Stored size: 477 Bytes

Contents

# Copyright sign

#def decimal_code_point_to_url_encoded(code_point)
#	utf_8_str = ([code_point.to_i].pack('U'))
#	'%' + utf_8_str.unpack('H2' * utf_8_str.length).join('%').upcase
#end

hex_code_point = 'A9'
decimal_code_point = '169'
hex_utf_8_bytes = '%C2%A9'

#puts 'Expected: ' + hex_utf_8_bytes
#puts 'Actual:   ' + decimal_code_point_to_url_encoded(decimal_code_point)

evil = 'javascript:alert("XSS")'
puts evil.unpack('H2' * evil.length).join('%').upcase

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sanitize-url-0.1.3 test.rb
sanitize-url-0.1.2 test.rb
sanitize-url-0.1.1 test.rb