Bug 145182 - When CUPS used as printing system in KDE, printer location and description not written in ASCII are shown as garbage in print dialogs
Summary: When CUPS used as printing system in KDE, printer location and description no...
Status: RESOLVED UNMAINTAINED
Alias: None
Product: kdeprint
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: VHI normal
Target Milestone: ---
Assignee: KDEPrint Devel Mailinglist
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-08 12:46 UTC by Alex Prokofiev
Modified: 2011-05-27 18:32 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Prokofiev 2007-05-08 12:46:55 UTC
Version:            (using KDE KDE 3.5.6)
Installed from:    Gentoo Packages
Compiler:          not important 
OS:                Linux

KDE assumes all data received from remote CUPS server to be in local charset,
which is incorrect - CUPS uses UTF8 everywhere by default.
This simple patch corrects this problem:

diff -ur kdeprint/cups/ipprequest.cpp kdeprint/cups/ipprequest.cpp
--- kdeprint/cups/ipprequest.cpp	2007-01-15 14:34:19.000000000 +0300
+++ kdeprint/cups/ipprequest.cpp	2007-05-08 14:37:01.000000000 +0400
@@ -260,7 +260,7 @@
 	ipp_attribute_t	*attr = ippFindAttribute(request_, name.latin1(), (ipp_tag_t)type);
 	if (attr)
 	{
-		value = QString::fromLocal8Bit(attr->values[0].string.text);
+		value = QString::fromUtf8(attr->values[0].string.text);
 		return true;
 	}
 	else return false;
@@ -274,7 +274,7 @@
 	if (attr)
 	{
 		for (int i=0;i<attr->num_values;i++)
-			values.append(QString::fromLocal8Bit(attr->values[i].string.text));
+			values.append(QString::fromUtf8(attr->values[i].string.text));
 		return true;
 	}
 	else return false;
diff -ur kdeprint/cups/kmcupsmanager.cpp kdeprint/cups/kmcupsmanager.cpp
--- kdeprint/cups/kmcupsmanager.cpp	2007-01-15 14:34:19.000000000 +0300
+++ kdeprint/cups/kmcupsmanager.cpp	2007-05-08 14:37:36.000000000 +0400
@@ -482,7 +482,7 @@
 		QString	attrname(attr->name);
 		if (attrname == "printer-name")
 		{
-			QString	value = QString::fromLocal8Bit(attr->values[0].string.text);
+			QString	value = QString::fromUtf8(attr->values[0].string.text);
 			printer->setName(value);
 			printer->setPrinterName(value);
 		}
@@ -512,7 +512,7 @@
 		}
 		else if (attrname == "printer-location")
 		{
-			printer->setLocation(QString::fromLocal8Bit(attr->values[0].string.text));
+			printer->setLocation(QString::fromUtf8(attr->values[0].string.text));
 		}
 		else if (attrname == "printer-is-accepting-jobs")
 		{
Comment 1 Kurt Pfeifle 2007-05-08 19:33:58 UTC
This patch should be checked, tested and applied ASAP.
Comment 2 Kurt Pfeifle 2007-05-08 19:34:30 UTC
Thanks for the patch, Alex!
Comment 3 Stephan Johach 2007-09-05 19:01:41 UTC
This fixes an issue with a german string viewed in kprinter. 

Typ: Laserdrucker (schwarz/weiß). 

The german ß is now shown correctly. Without the patch it was shown as garbage.
A quick test does not show any harm. The patch should be applied at least in trunk to get a broader testbase.
Comment 4 James Gilmour 2009-04-02 11:42:32 UTC
https://bugs.kde.org/show_bug.cgi?id=145182
Comment 5 John Layt 2011-05-27 18:32:59 UTC
KDEPrint is obsolete, unmaintained and will never be revived.  Closing all open bugs.