title: Attempts to parse bencode / torrent file in R
body: <p>I wish I could parse torrent files automatically via R. I tried to use <a href="https://github.com/vspinu/R-bencode" rel="nofollow noreferrer">R-bencode</a> package:</p>
  <pre><code>library('bencode')
  test_torrent &lt;- readLines('/home/user/Downloads/some_file.torrent', encoding = &quot;UTF-8&quot;)
  decoded_torrent &lt;- bencode::bdecode(test_torrent)
  </code></pre>
  <p>but faced to error:</p>
  <pre><code>Error in bencode::bdecode(test_torrent) : 
    input string terminated unexpectedly
  </code></pre>
  <p>In addition if I try to parse just part of this file <code>bdecode('\xe7\xc9\xe0\b\xfbD-\xd8\xd6(\xe2\004&gt;\x9c\xda\005Zar\x8c\xdfV\x88\022t\xe4գi]\xcf')</code>, I get</p>
  <pre><code>Error in bdecode(&quot;\xe7\xc9\xe0\b\xfbD-\xd8\xd6(\xe2\004&gt;\x9c\xda\005Zar\x8c\xdfV\x88\022t\xe4գi]\xcf&quot;) : 
    Wrong encoding '�'. Allowed values are i, l, d or a digit.
  </code></pre>
  <p>Maybe there are another ways to do it in R? Or probably I can insert another language code in Rscript?
  Thanks in advance!</p>