Skip to content
This repository was archived by the owner on Aug 13, 2026. It is now read-only.
This repository was archived by the owner on Aug 13, 2026. It is now read-only.

Duplicated charset when storing a RiakObject with a content type with charset [JIRA: CLIENTS-602] #549

Description

@gfbett

If I store a RiakObject with a content type of application/json;charset=UTF-8, the charset gets duplicated on the stored value when read by http, ending up with this content type:
application/json;charset=UTF-8; charset=UTF-8

I did a small sample to show the issue here:
https://github.com/gfbett/RiakIssueSample

Activity

  1. changed the title [-]Duplicated charset when storing a RiakObject with a content type with charset[/-] [+]Duplicated charset when storing a RiakObject with a content type with charset [JIRA: CLIENTS-602][/+] on Sep 23, 2015
  2. alexmoore commented on Jul 21, 2016

    @alexmoore
    Contributor

    Few issues here actually:

    1. When we manually set a charset on the RiakObject, it actually goes onto the content-type [0].
    2. When we convert the RiakObject to the ProtocolBuffer wire format, it will grab the charset off of the content-type buffer, but it won't remove it [1]. This is where we get the duplicate UTF-8.
    3. When we convert from the ProtocolBuffer wire format back to a RiakObject, the charset gets put back onto the content-type [2], but de-dupes it in the process [3].

    Also, according to the IETF, charset isn't a real optional parameter to the application/json content-type:

    Note: No "charset" parameter is defined for this registration.
    Adding one really has no effect on compliant recipients.

    http://www.iana.org/assignments/media-types/application/json

    With that, we should stop putting the charset on the content-type automatically. If the user includes it in both fields, it will be duplicated by Webmachine (As seen in the reproducer). If they put each value in each field respectively, it should come out as expected in Webmachine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions