As an tracker co-admin I sometimes need to debug tracker issues and it's handy to have a small converter:
I got as far as this:
> cat url
#!/usr/local/bin/ruby
require "cgi"
require "rubytorrent"
puts ARGV[0].to_s
puts ARGV[0].to_s.to_bencoding
puts CGI::escape(ARGV[0].to_s.to_bencoding)
but the generated doesnt seem right compared to bencoded + urlencoded strings by other clients:
> ruby url 2a4074ef5225865057cc49cd698b8477199779b6
2a4074ef5225865057cc49cd698b8477199779b6
40:2a4074ef5225865057cc49cd698b8477199779b6
40%3A2a4074ef5225865057cc49cd698b8477199779b6 |