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

RTF parser is tagging non-bold text as bold

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.16
    • None
    • None

    Description

      While parsing some RTF files I'm finding that the RTF parser tags many text spans as bold even if they are not. I am attaching a sample RTF file that exhibits this behavior. When parsing the file the first line is correctly tagged as bold. However the second line (the phone number) which is not supposed to be bold is tagged as bold.

      The following code demonstrates the problem.

      InputStream inputStream = Thread.currentThread().getContextClassLoader()
                      .getResourceAsStream("sample-rtf.rtf");
      
      Parser parser = new RTFParser();
      ContentHandler contentHandler = new ToXMLContentHandler();
      Metadata metadata = new Metadata();
      ParseContext context = new ParseContext();
      
      parser.parse(inputStream, contentHandler, metadata, context);
      String xml = contentHandler.toString();
      

      Attachments

        1. sample-rtf.rtf
          10 kB
          Dave Kincaid

        Activity

          People

            Unassigned Unassigned
            dkincaid Dave Kincaid
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: