r20680 by jghali -

scribus-commit scribus-commit at lists.scribus.net
Tue Jan 12 20:37:47 UTC 2016


Author: jghali
Date: Tue Jan 12 20:37:47 2016
New Revision: 20680

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20680
Log:
more elegant fix for codec selection issue in rtf importer

Modified:
    trunk/Scribus/scribus/third_party/rtf-qt/sladocumentrtfoutput.cpp

Modified: trunk/Scribus/scribus/third_party/rtf-qt/sladocumentrtfoutput.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20680&path=/trunk/Scribus/scribus/third_party/rtf-qt/sladocumentrtfoutput.cpp
==============================================================================
--- trunk/Scribus/scribus/third_party/rtf-qt/sladocumentrtfoutput.cpp	(original)
+++ trunk/Scribus/scribus/third_party/rtf-qt/sladocumentrtfoutput.cpp	Tue Jan 12 20:37:47 2016
@@ -47,7 +47,12 @@
 		m_fontTable.clear();
 		m_fontTableReal.clear();
 		m_codecList = QTextCodec::availableCodecs();
-		if (m_codecList.contains("cp1252") || m_codecList.contains("CP1252"))
+		for (int i = 0; i < m_codecList.count(); ++i)
+		{
+			QByteArray codecName = m_codecList.at(i);
+			m_codecList[i] = codecName.toLower();
+		}
+		if (m_codecList.contains("cp1252"))
 			m_codec = QTextCodec::codecForName("cp1252");		// Default ANSI codec
 		else
 			m_codec = QTextCodec::codecForLocale();
@@ -65,9 +70,9 @@
 		QByteArray ba;
 		ba.setNum(enc);
 		QByteArray encTest = "cp" + ba;
-		if (m_codecList.contains(encTest) || m_codecList.contains(encTest.toUpper()))
+		if (m_codecList.contains(encTest))
 			m_codec = QTextCodec::codecForName(encTest);
-		else if (m_codecList.contains("cp1252") || m_codecList.contains("CP1252"))
+		else if (m_codecList.contains("cp1252"))
 			m_codec = QTextCodec::codecForName("cp1252");
 	}
 




More information about the scribus-commit mailing list