diff --git a/src/calibre/gui2/convert/__init__.py b/src/calibre/gui2/convert/__init__.py
index c1efe5b9af..6b977afc19 100644
--- a/src/calibre/gui2/convert/__init__.py
+++ b/src/calibre/gui2/convert/__init__.py
@@ -191,7 +191,9 @@ class Widget(QWidget):
if not val: val = ''
getattr(g, 'setPlainText', g.setText)(val)
getattr(g, 'setCursorPosition', lambda x: x)(0)
- elif isinstance(g, QComboBox) and val:
+ elif isinstance(g, QComboBox):
+ if not val:
+ val = ''
idx = g.findText(val, Qt.MatchFixedString)
if idx < 0:
g.addItem(val)
diff --git a/src/calibre/gui2/convert/look_and_feel.ui b/src/calibre/gui2/convert/look_and_feel.ui
index 367233e2c0..cd0426ac53 100644
--- a/src/calibre/gui2/convert/look_and_feel.ui
+++ b/src/calibre/gui2/convert/look_and_feel.ui
@@ -84,7 +84,7 @@
...
-
+
:/images/wizard.png:/images/wizard.png
@@ -122,14 +122,8 @@
Input character &encoding:
-
- opt_input_encoding
-
- -
-
-
-
@@ -244,8 +238,22 @@
+ -
+
+
+ true
+
+
+
+
+
+ EncodingComboBox
+ QComboBox
+
+
+
diff --git a/src/calibre/gui2/convert/pdb_output.ui b/src/calibre/gui2/convert/pdb_output.ui
index 17bdc0a984..a571a0035b 100644
--- a/src/calibre/gui2/convert/pdb_output.ui
+++ b/src/calibre/gui2/convert/pdb_output.ui
@@ -55,10 +55,21 @@
-
-
+
+
+ true
+
+
+
+
+ EncodingComboBox
+ QComboBox
+
+
+
diff --git a/src/calibre/gui2/convert/pmlz_output.ui b/src/calibre/gui2/convert/pmlz_output.ui
index 9754752c8a..bd70cf1039 100644
--- a/src/calibre/gui2/convert/pmlz_output.ui
+++ b/src/calibre/gui2/convert/pmlz_output.ui
@@ -14,7 +14,7 @@
Form
- -
+
-
Qt::Vertical
@@ -27,32 +27,47 @@
- -
+
-
&Inline TOC
- -
+
-
Do not reduce image size and depth
- -
-
-
- Output Encoding:
-
-
-
- -
-
+
-
+
+
-
+
+
+ Output Encoding:
+
+
+
+ -
+
+
+ true
+
+
+
+
+
+
+ EncodingComboBox
+ QComboBox
+
+
+
diff --git a/src/calibre/gui2/convert/txt_output.ui b/src/calibre/gui2/convert/txt_output.ui
index 6290a096c8..3a2516b98e 100644
--- a/src/calibre/gui2/convert/txt_output.ui
+++ b/src/calibre/gui2/convert/txt_output.ui
@@ -96,10 +96,21 @@
-
-
+
+
+ true
+
+
+
+
+ EncodingComboBox
+ QComboBox
+
+
+
diff --git a/src/calibre/gui2/widgets.py b/src/calibre/gui2/widgets.py
index bc3c23876f..cab2e2d4df 100644
--- a/src/calibre/gui2/widgets.py
+++ b/src/calibre/gui2/widgets.py
@@ -616,6 +616,32 @@ class ComboBoxWithHelp(QComboBox):
QComboBox.hidePopup(self)
self.set_state()
+
+class EncodingComboBox(QComboBox):
+ '''
+ A combobox that holds text encodings support
+ by Python. This is only populated with the most
+ common and standard encodings. There is no good
+ way to programatically list all supported encodings
+ using encodings.aliases.aliases.keys(). It
+ will not work.
+ '''
+
+ ENCODINGS = ['', 'ascii', 'big5', 'cp1250', 'cp1251', 'cp1252', 'cp1253',
+ 'cp1254', 'cp1255', 'cp1256', 'euc_jp', 'euc_kr', 'gb2312', 'gb18030',
+ 'hz', 'iso2022_jp', 'iso2022_kr', 'iso8859_5', 'latin_1', 'shift_jis',
+ 'utf_8',
+ ]
+
+ def __init__(self, parent=None):
+ QComboBox.__init__(self, parent)
+ self.setEditable(True)
+ self.setLineEdit(EnLineEdit(self))
+
+ for item in self.ENCODINGS:
+ self.addItem(item)
+
+
class PythonHighlighter(QSyntaxHighlighter):
Rules = []