changeset 43:f9a0b2b6832e

Sanitize input and unify Lineendings
author Andre Heinecke <andre.heinecke@intevation.de>
date Thu, 12 May 2016 17:35:49 +0200
parents 8b6cb95d00be
children aa47b8e4f807
files src/converter.cpp src/l10n/main_de_DE.ts
diffstat 2 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/converter.cpp	Fri Apr 15 15:36:49 2016 +0200
+++ b/src/converter.cpp	Thu May 12 17:35:49 2016 +0200
@@ -174,13 +174,17 @@
     xlsx.mergeCells("A1:C1");
     xlsx.setRowHeight(1, TITLE_ROW_HEIGHT);
 
-    const QString input = instream.readAll();
+    QString input = instream.readAll();
 
     QRegularExpression questionEx(QUESTION_PATTERN);
     QRegularExpression choiceEx(CHOICE_PATTERN);
     QRegularExpression choiceAltEx(CHOICE_UNFILLED_PATTERN);
     QRegularExpression freetxtEx(FREETXT_PATTERN);
 
+    input.replace("\r\n", "\n");
+    input.replace("\n\r", "\n");
+    input.replace("#NAME?\n", "");
+
     QRegularExpressionMatch match = questionEx.match(input);
     bool foundSomething = false;
     int cursor = match.capturedEnd();
--- a/src/l10n/main_de_DE.ts	Fri Apr 15 15:36:49 2016 +0200
+++ b/src/l10n/main_de_DE.ts	Thu May 12 17:35:49 2016 +0200
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE TS>
-<TS version="2.0" language="de_DE">
+<TS version="2.1" language="de_DE">
 <context>
     <name></name>
     <message>
@@ -31,12 +31,12 @@
         <translation>Die Datei &quot;%1&quot; konnte nicht geƶffnet werden.</translation>
     </message>
     <message>
-        <location filename="../converter.cpp" line="361"/>
+        <location filename="../converter.cpp" line="362"/>
         <source>Failed to parse input document.</source>
         <translation>Fehler bei der verarbeitung des Eingabedokuments.</translation>
     </message>
     <message>
-        <location filename="../converter.cpp" line="394"/>
+        <location filename="../converter.cpp" line="395"/>
         <source>Saving the XLSX document failed.</source>
         <translation>Das erstellen des XLSX Dokuments ist fehlgeschlagen.</translation>
     </message>
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)