Uploaded image for project: 'Tika'
  1. Tika
  2. TIKA-4278

TextAndCSVParser doesn't detect semicolon separated file

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.9.2
    • 3.0.0, 2.9.3
    • parser

    Description

      I ran the code from the attached SO issue and yes it doesn't detect semicolon separated files. The reason is this line in TextAndCSVParser.java:

      private static final char[] DEFAULT_DELIMITERS = new char[]\{',', '\t'};
      

      This is later used by CSVSniffer. For some reason the other delimiters (pipe, colon and semicolon) aren't in that array, although they are in CHAR_TO_STRING_DELIMITER_MAP. I modified DEFAULT_DELIMITERS and now it works for semicolon.

      Can I change this by adding the missing delimiters or was there a reason that I missed? Proposed change would change CSVSniffer so that delimiters is a set and then pass CHAR_TO_STRING_DELIMITER_MAP.keySet().

      Attachments

        1. reports_csv_3.0.0_vs_3.0.0_nocolon.tar.xz
          605 kB
          Tilman Hausherr
        2. reports_csv_3.0.0_vs_3.0.0_new_withcolon.tar.xz
          565 kB
          Tilman Hausherr
        3. reports_csv_2.9.2_vs_2.9.3.tar.xz
          716 kB
          Tilman Hausherr
        4. reports_csv_2.9.2_vs_2.9.3_4.tar.xz
          733 kB
          Tilman Hausherr
        5. reports_csv_2.9.2_vs_2.9.3_3.tar.xz
          726 kB
          Tilman Hausherr

        Issue Links

          Activity

            People

              Unassigned Unassigned
              tilman Tilman Hausherr
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: