Ver Fonte

Fix pasring csv cells with multiple quoted parts

AlexVinS há 10 anos atrás
pai
commit
f310be5d5f
1 ficheiros alterados com 15 adições e 3 exclusões
  1. 15 3
      lib/CGeneralTextHandler.cpp

+ 15 - 3
lib/CGeneralTextHandler.cpp

@@ -206,12 +206,24 @@ std::string CLegacyConfigParser::extractQuotedString()
 	{
 		ret += extractQuotedPart();
 
-		// double quote - add it to string and continue unless
-		// line terminated using tabulation
-		if (curr < end && *curr == '\"' && *curr != '\t')
+		// double quote - add it to string and continue quoted part
+		if (curr < end && *curr == '\"')
 		{
 			ret += '\"';
 		}
+		//extract normal part
+		else if(curr < end && *curr != '\t' && *curr != '\r')
+		{
+			char * begin = curr;
+
+			while (curr < end && *curr != '\t' && *curr != '\r' && *curr != '\"')//find end of string or next quoted part start
+				curr++;	
+				
+			ret += std::string(begin, curr);
+			
+			if(curr>=end || *curr != '\"')
+				return ret;
+		}		
 		else // end of string
 			return ret;
 	}