r14931 by fschmid - AI Importer: Read color names in Utf8 encoding.

scribus-commit scribus-commit at lists.scribus.net
Wed Mar 24 22:40:50 CET 2010


Revision: 14931
Author: fschmid
Date: 2010-03-24T21:39:54.983001Z
Commit message: AI Importer: Read color names in Utf8 encoding.

Changeset: 
M  /trunk/Scribus/scribus/plugins/import/ai/importai.cpp

Diffs:
Index: scribus/plugins/import/ai/importai.cpp
===================================================================
--- scribus/plugins/import/ai/importai.cpp	(revision 14930)
+++ scribus/plugins/import/ai/importai.cpp	(revision 14931)
@@ -933,6 +933,16 @@
 					FarNam = FarNam.remove(0,1);
 					FarNam = FarNam.remove(FarNam.length()-1,1);
 					FarNam = FarNam.simplified();
+					QByteArray farN;
+					for (int a = 0; a < FarNam.length(); a++)
+					{
+						QChar ch = FarNam.at(a);
+						uint chc = ch.unicode();
+						if (chc > 255)
+							farN.append(chc >> 8);
+						farN.append(chc & 0x00FF);
+					}
+					FarNam = QString::fromUtf8(farN.constData());
 					cc = ScColor(qRound(255 * c), qRound(255 * m), qRound(255 * yc), qRound(255 * k));
 					cc.setSpotColor(true);
 					if ((!CustColors.contains(FarNam)) && (!FarNam.isEmpty()))
@@ -954,6 +964,16 @@
 						FarNam = FarNam.remove(0,1);
 						FarNam = FarNam.remove(FarNam.length()-1,1);
 						FarNam = FarNam.simplified();
+						QByteArray farN;
+						for (int a = 0; a < FarNam.length(); a++)
+						{
+							QChar ch = FarNam.at(a);
+							uint chc = ch.unicode();
+							if (chc > 255)
+								farN.append(chc >> 8);
+							farN.append(chc & 0x00FF);
+						}
+						FarNam = QString::fromUtf8(farN.constData());
 						cc = ScColor(qRound(255 * c), qRound(255 * m), qRound(255 * yc), qRound(255 * k));
 						cc.setSpotColor(true);
 						if ((!CustColors.contains(FarNam)) && (!FarNam.isEmpty()))
@@ -978,6 +998,16 @@
 					FarNam = FarNam.remove(0,1);
 					FarNam = FarNam.remove(FarNam.length()-1,1);
 					FarNam = FarNam.simplified();
+					QByteArray farN;
+					for (int a = 0; a < FarNam.length(); a++)
+					{
+						QChar ch = FarNam.at(a);
+						uint chc = ch.unicode();
+						if (chc > 255)
+							farN.append(chc >> 8);
+						farN.append(chc & 0x00FF);
+					}
+					FarNam = QString::fromUtf8(farN.constData());
 					cc = ScColor(qRound(255 * c), qRound(255 * m), qRound(255 * yc));
 					if ((!CustColors.contains(FarNam)) && (!FarNam.isEmpty()))
 						CustColors.insert(FarNam, cc);
@@ -998,6 +1028,16 @@
 						FarNam = FarNam.remove(0,1);
 						FarNam = FarNam.remove(FarNam.length()-1,1);
 						FarNam = FarNam.simplified();
+						QByteArray farN;
+						for (int a = 0; a < FarNam.length(); a++)
+						{
+							QChar ch = FarNam.at(a);
+							uint chc = ch.unicode();
+							if (chc > 255)
+								farN.append(chc >> 8);
+							farN.append(chc & 0x00FF);
+						}
+						FarNam = QString::fromUtf8(farN.constData());
 						cc = ScColor(qRound(255 * c), qRound(255 * m), qRound(255 * yc));
 						if ((!CustColors.contains(FarNam)) && (!FarNam.isEmpty()))
 							CustColors.insert(FarNam, cc);
@@ -1021,6 +1061,16 @@
 							int en = tmp.lastIndexOf(")");
 							FarNam = tmp.mid(an+1, en-an-1);
 							FarNam = FarNam.simplified();
+							QByteArray farN;
+							for (int a = 0; a < FarNam.length(); a++)
+							{
+								QChar ch = FarNam.at(a);
+								uint chc = ch.unicode();
+								if (chc > 255)
+									farN.append(chc >> 8);
+								farN.append(chc & 0x00FF);
+							}
+							FarNam = QString::fromUtf8(farN.constData());
 						}
 						tmp = readLinefromDataStream(ts);
 						if (tmp.endsWith("Pc"))
@@ -1032,6 +1082,16 @@
 								int en = tmp.indexOf(")");
 								FarNam = tmp.mid(0, en);
 								FarNam = FarNam.simplified();
+								QByteArray farN;
+								for (int a = 0; a < FarNam.length(); a++)
+								{
+									QChar ch = FarNam.at(a);
+									uint chc = ch.unicode();
+									if (chc > 255)
+										farN.append(chc >> 8);
+									farN.append(chc & 0x00FF);
+								}
+								FarNam = QString::fromUtf8(farN.constData());
 							}
 							cc = ScColor(qRound(255 * c), qRound(255 * m), qRound(255 * yc), qRound(255 * k));
 							cc.setSpotColor(true);




More information about the scribus-commit mailing list