I’m trying to download a file using Ruby and Open-URI but I’m running into a problem with filenames containing brackets ( ‘[‘ and ‘]’ ).
According to this page, brackets in URLs in this position is invalid because they’re supposed to be encoded before that point. An example URL that I’m trying to retrieve would be:
"http://torrent.zoink.it/National.Geographic.Desert.Seas.PDTV.XviD.MP3.[MVGroup.org].torrent"
How do I retrieve such a file with Ruby Open-URI? Googling has not revealed helpful results besides that link. Thanks in advance!
You need to percent-encode (urlencode) the brackets. Since you just want to replace the brackets, and not encode any other charaters, I’d just
.subthem in.