Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-9322

Response is broken for String entities if charset is not explicitly specified

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.1.0.ER2
    • 7.1.0.DR13
    • REST
    • None

      If the response entity type is a String and the charset is not explicitly set, the String is converted to a byte[] using UTF-8. Since the default charset in HTTP is ISO-8859-1, the responses are invalid. Either, the conversion should use o.getBytes(StandardCharsets.ISO_8859_1) or the response charset should be set to utf-8 in that case.

      I recommend to set "utf-8" charset.

      This is violation of HTTP 1.1 specification, chapter "3.7.1 Canonicalization and Text Defaults":

      The "charset" parameter is used with some media types to define the
      character set (section 3.4) of the data. When no explicit charset
      parameter is provided by the sender, media subtypes of the "text"
      type are defined to have a default charset value of "ISO-8859-1" when
      received via HTTP. Data in character sets other than "ISO-8859-1" or
      its subsets MUST be labeled with an appropriate charset value. See
      section 3.4.1 for compatibility problems.

              rsigal@redhat.com Ronald Sigal
              mkopecky@redhat.com Marek Kopecky
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: