system-config-printer/system-config-printer-utf8-971417.patch

66 lines
3.3 KiB
Diff

diff -up system-config-printer-1.4.1/newprinter.py.utf8-971417 system-config-printer-1.4.1/newprinter.py
--- system-config-printer-1.4.1/newprinter.py.utf8-971417 2013-06-06 17:11:08.781804207 +0100
+++ system-config-printer-1.4.1/newprinter.py 2013-06-06 17:11:46.179991962 +0100
@@ -1632,7 +1632,7 @@ class NewPrinterGUI(GtkGUI):
def on_entNPName_changed(self, widget):
# restrict
- text = unicode (widget.get_text(), locale.getpreferredencoding ())
+ text = unicode (widget.get_text(), 'utf-8')
new_text = text
new_text = new_text.replace("/", "")
new_text = new_text.replace("#", "")
@@ -2513,10 +2513,10 @@ class NewPrinterGUI(GtkGUI):
def entry_changed(self, entry, allowed_chars):
"Remove all chars from entry's text that are not in allowed_chars."
try:
- allowed_chars = unicode (allowed_chars, locale.getpreferredencoding())
+ allowed_chars = unicode (allowed_chars, 'utf-8')
except UnicodeDecodeError:
allowed_chars = unicode (allowed_chars)
- origtext = unicode (entry.get_text(), locale.getpreferredencoding ())
+ origtext = unicode (entry.get_text(), 'utf-8')
new_text = origtext
for char in origtext:
if char not in allowed_chars:
@@ -3883,10 +3883,9 @@ class NewPrinterGUI(GtkGUI):
self.dec_spinner_task ()
if self.dialog_mode in ("class", "printer", "printer_with_uri"):
- enc = locale.getpreferredencoding ()
- name = unicode (self.entNPName.get_text(), enc)
- location = unicode (self.entNPLocation.get_text(), enc)
- info = unicode (self.entNPDescription.get_text(), enc)
+ name = unicode (self.entNPName.get_text(), 'utf-8')
+ location = unicode (self.entNPLocation.get_text(), 'utf-8')
+ info = unicode (self.entNPDescription.get_text(), 'utf-8')
else:
name = self._name
diff -up system-config-printer-1.4.1/printerproperties.py.utf8-971417 system-config-printer-1.4.1/printerproperties.py
--- system-config-printer-1.4.1/printerproperties.py.utf8-971417 2013-06-06 17:11:08.776804182 +0100
+++ system-config-printer-1.4.1/printerproperties.py 2013-06-06 17:11:46.179991962 +0100
@@ -688,7 +688,7 @@ class PrinterPropertiesDialog(GtkGUI):
old_value = old_values[widget]
if type (old_value) == unicode:
- old_value = old_value.encode (locale.getpreferredencoding ())
+ old_value = old_value.encode ('utf-8')
if old_value == value:
self.changed.discard(widget)
@@ -1041,10 +1041,9 @@ class PrinterPropertiesDialog(GtkGUI):
for member in old_members:
self.cups.deletePrinterFromClass(member, name)
- enc = locale.getpreferredencoding ()
- location = self.entPLocation.get_text().decode (enc)
- info = self.entPDescription.get_text().decode (enc)
- device_uri = self.entPDevice.get_text().decode (enc)
+ location = self.entPLocation.get_text().decode ('utf-8')
+ info = self.entPDescription.get_text().decode ('utf-8')
+ device_uri = self.entPDevice.get_text().decode ('utf-8')
enabled = self.chkPEnabled.get_active()
accepting = self.chkPAccepting.get_active()