diff --git a/README.md b/README.md index 5c55d37..7796721 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Using NumPy (http://www.numpy.org), the plugin supports evaluating Python expres All the above features work in both justified and collapsed modes. -Finally, the plugin has full support for RFC 4180 quoting. +Finally, the plugin fully supports RFC 4180 (https://tools.ietf.org/html/rfc4180) quoting, with the exception that quoted newlines (2.6) are treated as row separators. ## Install diff --git a/csvplugin.py b/csvplugin.py index ade9ede..1a6572a 100644 --- a/csvplugin.py +++ b/csvplugin.py @@ -307,24 +307,20 @@ def ParseRow(self, row): while char_index < len(row): char = row[char_index] - if char_index < len(row) - 1: - next_char = row[char_index + 1] - else: - next_char = None - - if char == '"' and next_char == '"': - if self.auto_quote: - currentword += '"' - else: - currentword += '""' - char_index += 2 - continue - if insidequotes: if char == '"': + if char_index < len(row) - 1 and row[char_index + 1] == '"': + if self.auto_quote: + currentword += '"' + else: + currentword += '""' + char_index += 2 + continue + insidequotes = False if not self.auto_quote: currentword += char + else: currentword += char diff --git a/quote.csv b/quote.csv new file mode 100644 index 0000000..d6f2023 --- /dev/null +++ b/quote.csv @@ -0,0 +1,4 @@ +a,"b """,456 +,b +123abc,"45,6" +"","","" \ No newline at end of file