Skip to content
  • Thomas Sibley's avatar
    Encode JSON strings as Perl character strings instead of UTF-8 bytes · 18a6bd8b
    Thomas Sibley authored
    If JSON() produces UTF-8 bytes, it can't be used in Mason pages with
    other content.  Mason pages are constructed using Perl character
    strings and then our PSGI response callback in
    RT::Interface::Web::Handler encodes all content as UTF-8 if it's not
    already encoded.  This leads to double-encoding when JSON() output is
    mixed with other content, such as in /Elements/JavascriptConfig.
    
    The autocomplete endpoints which used JSON() worked successfully because
    their _entire_ page content was UTF-8 already, so it wasn't encoded
    again by the response callback.  By switching JSON() away from UTF-8,
    interpolation issues are fixed and the autocomplete endpoints now rely
    on the request handler encoding to UTF-8 instead.
    
    Additionally, replace various uses of JSON::to_json() directly with
    JSON().
    18a6bd8b