r25088 by jghali - #16786: Improve choice between latin1 and utf-8 encoding when generating barcode

scribus-commit scribus-commit at lists.scribus.net
Wed May 4 20:46:06 UTC 2022


Author: jghali
Date: Wed May  4 20:46:06 2022
New Revision: 25088

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=25088
Log:
#16786: Improve choice between latin1 and utf-8 encoding when generating barcode

Modified:
    trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp

Modified: trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25088&path=/trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp	(original)
+++ trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp	Wed May  4 20:46:06 2022
@@ -819,9 +819,10 @@
 				"end\n"
 				);
 	QString comm("20 10 moveto <%1> <%2> /%3 /uk.co.terryburton.bwipp findresource exec\n");
+	QString bcString = ui.codeEdit->text();
 	QByteArray bcLatin1 = ui.codeEdit->text().toLatin1();
 	QByteArray bcUtf8 = ui.codeEdit->text().toUtf8();
-	QByteArray bcArray = (bcLatin1 != bcUtf8) ? ("\xef\xbb\xbf" + bcUtf8) : bcLatin1;
+	QByteArray bcArray = (bcString != QString::fromLatin1(bcLatin1)) ? ("\xef\xbb\xbf" + bcUtf8) : bcLatin1;
 	QString bcdata(bcArray.toHex());
 	QString bcopts(opts.toLatin1().toHex());
 	comm = comm.arg(bcdata, bcopts, map[ui.bcCombo->currentText()].command);




More information about the scribus-commit mailing list