# Buggy code
def on_create_clicked(self):
    if self.window().create_torrent_files_list.count() == 0:
        self.dialog = ConfirmationDialog(
            self,
            "Notice",
            "You should add at least one file to your torrent.",
            [("CLOSE", BUTTON_TYPE_NORMAL)],
        )
        self.dialog.button_clicked.connect(self.on_dialog_ok_clicked)
        self.dialog.show()
        return

    files_str = ""
    for ind in xrange(self.window().create_torrent_files_list.count()):
        files_str += "files[]=%s&" % urllib.quote_plus(
            self.window().create_torrent_files_list.item(ind).text()
        )

    description = urllib.quote_plus(
        self.window().create_torrent_description_field.toPlainText()
    )
    post_data = ("%s&description=%s" % (files_str[:-1], description)).encode("utf-8")
    url = (
        "createtorrent?download=1"
        if self.window().seed_after_adding_checkbox.isChecked()
        else "createtorrent"
    )
    self.request_mgr = TriblerRequestManager()
    self.request_mgr.perform_request(
        url, self.on_torrent_created, data=post_data, method="POST"
    )


# Traceback (KeyError)
Traceback (most recent call last):
File "/home/tribler/tribler/TriblerGUI/widgets/downloadsdetailstabwidget.py", line 163, in <lambda>
exclude_action.triggered.connect(lambda: self.on_files_excluded(selected_files_info))
File "/home/tribler/tribler/TriblerGUI/widgets/downloadsdetailstabwidget.py", line 188, in on_files_excluded
self.set_included_files(included_list)
File "/home/tribler/tribler/TriblerGUI/widgets/downloadsdetailstabwidget.py", line 191, in set_included_files
data_str = ''.join(u"selected_files[]=%s&amp;" % quote_plus(file) for file in files)[:-1].encode('utf-8')
File "/home/tribler/tribler/TriblerGUI/widgets/downloadsdetailstabwidget.py", line 191, in <genexpr>
data_str = ''.join(u"selected_files[]=%s&amp;" % quote_plus(file) for file in files)[:-1].encode('utf-8')
File "/usr/lib/python2.7/urllib.py", line 1299, in quote_plus
s = quote(s, safe + ' ')
File "/usr/lib/python2.7/urllib.py", line 1294, in quote
return ''.join(map(quoter, s))
KeyError: u'\u0413'

# Fixed code
def on_create_clicked(self):
    if self.window().create_torrent_files_list.count() == 0:
        self.dialog = ConfirmationDialog(
            self,
            "Notice",
            "You should add at least one file to your torrent.",
            [("CLOSE", BUTTON_TYPE_NORMAL)],
        )
        self.dialog.button_clicked.connect(self.on_dialog_ok_clicked)
        self.dialog.show()
        return

    files_str = ""
    for ind in xrange(self.window().create_torrent_files_list.count()):
        files_str += "files[]=%s&" % urllib.quote_plus(
            self.window().create_torrent_files_list.item(ind).text().encode("utf-8")
        )

    description = urllib.quote_plus(
        self.window().create_torrent_description_field.toPlainText()
    )
    post_data = ("%s&description=%s" % (files_str[:-1], description)).encode("utf-8")
    url = (
        "createtorrent?download=1"
        if self.window().seed_after_adding_checkbox.isChecked()
        else "createtorrent"
    )
    self.request_mgr = TriblerRequestManager()
    self.request_mgr.perform_request(
        url, self.on_torrent_created, data=post_data, method="POST"
    )