mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
If the user specifies an unknown encoding, automatically change it to None
This commit is contained in:
parent
91ba0d2df4
commit
9af7ba996f
@ -6,7 +6,7 @@ __license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import textwrap
|
||||
import textwrap, codecs
|
||||
from functools import partial
|
||||
|
||||
from PyQt4.Qt import QWidget, QSpinBox, QDoubleSpinBox, QLineEdit, QTextEdit, \
|
||||
@ -128,6 +128,7 @@ class Widget(QWidget):
|
||||
def get_value(self, g):
|
||||
from calibre.gui2.convert.xpath_wizard import XPathEdit
|
||||
from calibre.gui2.convert.regex_builder import RegexEdit
|
||||
from calibre.gui2.widgets import EncodingComboBox
|
||||
ret = self.get_value_handler(g)
|
||||
if ret != 'this is a dummy return value, xcswx1avcx4x':
|
||||
return ret
|
||||
@ -139,6 +140,13 @@ class Widget(QWidget):
|
||||
if not ans:
|
||||
ans = None
|
||||
return ans
|
||||
elif isinstance(g, EncodingComboBox):
|
||||
ans = unicode(g.currentText()).strip()
|
||||
try:
|
||||
codecs.lookup(ans)
|
||||
except:
|
||||
ans = ''
|
||||
return ans
|
||||
elif isinstance(g, QComboBox):
|
||||
return unicode(g.currentText())
|
||||
elif isinstance(g, QCheckBox):
|
||||
|
Loading…
x
Reference in New Issue
Block a user