enapps-enorman commented on PR #636:
URL: 
https://github.com/apache/sling-org-apache-sling-starter/pull/636#issuecomment-4763692320

   > I do not know yet, did not look into the root cause. While it's very 
likely that we should adjust the tests it might be something that we want to 
configure away or maybe even a bug in Felix HTTP, overwriting the charset.
   
   @rombert  From what I can suss out, the sudden appearance of the 
;charset=utf-8 suffix is the direct result of a major architectural rewrite 
introduced in Jetty 12. Prior versions of Jetty did not automatically append 
the suffix to your Content-Type header, but Jetty 12.1 does it by default due 
to a foundational shift in how the container prioritizes web standards.
   
   The change comes down to a major shift in the core 
[encoding.properties](https://github.com/jetty/jetty.project/blob/jetty-12.1.x/jetty-core/jetty-http/src/main/resources/org/eclipse/jetty/http/encoding.properties)
 modernization.  In older versions of Jetty, the internal encoding.properties 
configuration file favored legacy rules. However, starting with the newer Jetty 
12 core architecture, the engineering team modernized the default file mapping 
to align with modern HTTP and HTML5 standards. They explicitly changed the 
mapping for HTML to text/html=utf-8 inside the core engine. Because it is 
registered as an inferred encoding type, Jetty’s core HTTP layer is now 
designed to actively intercept any response set to text/html and automatically 
stamp ;charset=utf-8 onto the outgoing HTTP header if no other encoding was 
explicitly specified.
   
   So updating the tests to compensate seems like the right solution to me as 
the response header doesn't seem to be incorrect.
   
   Alternatively, API calls could programmatically change back to the way it 
was before with something like this:
   ```
   // Processes bytes as UTF-8 internally, but keeps the header strictly as 
"text/html"
   context.getMimeTypes().addAssumed("text/xml", "UTF-8");
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to