r25084 by jghali - #16786: QR code generated by "Insert Barcode" could not show CJK characters correctly

scribus-commit scribus-commit at lists.scribus.net
Sun May 1 21:50:00 UTC 2022


Author: jghali
Date: Sun May  1 21:49:59 2022
New Revision: 25084

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=25084
Log:
#16786: QR code generated by "Insert Barcode" could not show CJK characters correctly

Modified:
    branches/Version15x/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp

Modified: branches/Version15x/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25084&path=/branches/Version15x/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp
==============================================================================
--- branches/Version15x/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp	(original)
+++ branches/Version15x/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp	Sun May  1 21:49:59 2022
@@ -817,7 +817,10 @@
 				"end\n"
 				);
 	QString comm("20 10 moveto <%1> <%2> /%3 /uk.co.terryburton.bwipp findresource exec\n");
-	QString bcdata(ui.codeEdit->text().toLatin1().toHex());
+	QByteArray bcLatin1 = ui.codeEdit->text().toLatin1();
+	QByteArray bcUtf8 = ui.codeEdit->text().toUtf8();
+	QByteArray bcArray = (bcLatin1 != bcUtf8) ? ("\xef\xbb\xbf" + bcUtf8) : bcLatin1;
+	QString bcdata(bcArray.toHex());
 	QString bcopts(opts.toLatin1().toHex());
 	comm = comm.arg(bcdata, bcopts, map[ui.bcCombo->currentText()].command);
 	psCommand.append(comm);




More information about the scribus-commit mailing list