Menu

#4 Torrent file is in UTF-8 encoding

open
nobody
None
5
2011-11-29
2011-11-29
Cyril C.
No

It is said in http://en.wikipedia.org/wiki/Torrent_file that the torrent file is encoded as UTF-8.

I had troubles reading a torrent file containing file names with accents (éàè...)

The following code works fine:
final jBittorrentAPI.TorrentProcessor torrentProcessor = new jBittorrentAPI.TorrentProcessor();
final Map<?, ?> parseTorrent = torrentProcessor.parseTorrent(torrentFile);
final jBittorrentAPI.TorrentFile jBittorrentFile = torrentProcessor.getTorrentFile(parseTorrent);
String name = (String) jBittorrentFile.name.get(i);
String nameAsUtf8 = new String(name.getBytes(), "UTF-8");

Discussion


Log in to post a comment.

MongoDB Logo MongoDB