Created
August 2, 2013 20:18
Revisions
-
srinivasmohan created this gist
Aug 2, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ [smohan@dhcpa-111 ~]$ irb irb(main):001:0> require 'uri' => true irb(main):002:0> p URI::Parser.new.regexp[:UNSAFE] /[^\-_.!~*'()a-zA-Z\d;\/?:@&=+$,\[\]]/ => /[^\-_.!~*'()a-zA-Z\d;\/?:@&=+$,\[\]]/ irb(main):003:0> p Regexp.union([URI::Parser.new.regexp[:UNSAFE],'~','@']) /(?-mix:[^\-_.!~*'()a-zA-Z\d;\/?:@&=+$,\[\]])|~|@/ => /(?-mix:[^\-_.!~*'()a-zA-Z\d;\/?:@&=+$,\[\]])|~|@/ irb(main):004:0> irb(main):005:0* irb(main):006:0* irb(main):007:0* irb(main):008:0* puts URI::encode("/touch/123~ipad.png") /touch/123~ipad.png => nil irb(main):009:0> puts URI::encode("/touch/123~ipad.png", Regexp.union([URI::Parser.new.regexp[:UNSAFE],'~','@'])) /touch/123%7Eipad.png => nil irb(main):010:0> puts URI::encode("/touch/[email protected]") /touch/[email protected] => nil irb(main):011:0> puts URI::encode("/touch/[email protected]", Regexp.union([URI::Parser.new.regexp[:UNSAFE],'~','@'])) /touch/123%40ipad.png => nil irb(main):012:0> [smohan@dhcpa-111 ~]$