Tika
  1. Tika
  2. TIKA-822

MediaType fails to parse charset that has quoted value

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0
    • Fix Version/s: 1.1
    • Component/s: mime
    • Labels:
      None

      Description

      If a mime type is

      text/html; charset="UTF-8"

      the value is incorrectly "UTF-8" not UTF-8

      patch available at https://github.com/osi/tika/commit/b77814874ebff8f412ebb2f2adc52c6465d603c4

      i have a CLA on file.

        Activity

        peter royal created issue -
        Hide
        Nick Burch added a comment -

        Should we handle single quotes too? I don't think they're valid for http, but potentially could crop up in other situations

        Show
        Nick Burch added a comment - Should we handle single quotes too? I don't think they're valid for http, but potentially could crop up in other situations
        Hide
        peter royal added a comment -

        the rfc for mime isn't clear on whether single quotes make a valid quoted string. overall, the parser needs a bit more work to be fully rfc-compliant (quoted strings can have equals in them, for instance).

        I was just trying to fix the simple case I came across. the java mail API generates quoted charset fields for text attachments, which is how I found this.

        Show
        peter royal added a comment - the rfc for mime isn't clear on whether single quotes make a valid quoted string. overall, the parser needs a bit more work to be fully rfc-compliant (quoted strings can have equals in them, for instance). I was just trying to fix the simple case I came across. the java mail API generates quoted charset fields for text attachments, which is how I found this.
        peter royal made changes -
        Field Original Value New Value
        Comment [ the rfc for mime isn't clear on whether single quotes make a valid quoted string. overall, the parser needs a bit more work to be fully rfc-compliant (quoted strings can have equals in them, for instance).

        I was just trying to fix the simple case I came across. the java mail API generates quoted charset fields for text attachments, which is how I found this. ]
        Hide
        Nick Burch added a comment -

        OK, thanks for the info and the patch. I've added it, along with single quote support and a note about the outstanding issues for quoted strings, in r1221581.

        Show
        Nick Burch added a comment - OK, thanks for the info and the patch. I've added it, along with single quote support and a note about the outstanding issues for quoted strings, in r1221581.
        Nick Burch made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.1 [ 12318849 ]
        Resolution Fixed [ 1 ]
        Hide
        peter royal added a comment -

        thanks!

        Show
        peter royal added a comment - thanks!

          People

          • Assignee:
            Unassigned
            Reporter:
            peter royal
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development