Summary
I am experiencing an issue I only see with htmx responses that is why I open the issue here, but it might be a spring boot 3.2.3 issue.
After switching form spring boot 3.2.2 to 3.2.3 I see broken "umlauts". Switching back to 3.2.2 shows correct "umlauts".
Response header looks fine, content "looks" identical but the weird thing is that the content length is different, off by 1 B (3.2.3 has -1 B). Unsure if this is the issue.
Spring Boot
3.2.3
Details
3.2.3
HTTP/1.1 200
Content-Type: text/html;charset=UTF-8
Content-Language: de
Content-Length: 214
Date: Fri, 23 Feb 2024 16:08:47 GMT
Keep-Alive: timeout=60
Connection: keep-alive
3.2.2
HTTP/1.1 200
Content-Type: text/html;charset=UTF-8
Content-Language: de
Content-Length: 215
Date: Fri, 23 Feb 2024 16:14:01 GMT
Keep-Alive: timeout=60
Connection: keep-alive
I use the Thymeleaf with spring-boot-htmx (and issue also filed there https://github.com/wimdeblauwe/htmx-spring-boot/issues/99).
Comment From: philwebb
This is unlikely to be an issue in Spring Boot itself, but it could be caused by a dependency upgrade that we manage. I would suspect Spring Framework or Tomcat would be the most likely candidates.
@resmo Do you have a small reproducer project that you can provide? This might help us identify what's changed.
Comment From: resmo
I created a reproducer and can say, that I am only able to reproduce it in 3.2.3 using the helper library io.github.wimdeblauwe -> htmx-spring-boot
reproducer repo https://github.com/resmo/spring-boot-3.2.3-demo-htmx-umlauts
Comment From: scottfrederick
See https://github.com/wimdeblauwe/htmx-spring-boot/issues/99
Comment From: scottfrederick
@resmo I've tried your reproducer, and I see the umlauts when clicking on both links regardless of the Spring Boot version. I've tested it in Chrome and Firefox, running the app with ./mvnw spring-boot:run or java -jar target/repro-0.0.1-SNAPSHOT.jar. Are there additional instructions for running the app that you can provide?
Also, can you try setting the property <spring-framework.version>6.1.3</spring-framework.version> in the <properties> section of your pom.xml when building against Spring Boot 3.2.3? Framework was upgraded from 6.1.3 to 6.1.4 between Boot 3.2.2 and 3.2.3, so forcing the downgrade with Boot 3.2.3 would help narrow down the root of the problem.
Comment From: resmo
@scottfrederick
I've tried your reproducer, and I see the umlauts when clicking on both links regardless of the Spring Boot version. I've tested it in Chrome and Firefox, running the app with
./mvnw spring-boot:runorjava -jar target/repro-0.0.1-SNAPSHOT.jar. Are there additional instructions for running the app that you can provide?
very interesting: you did everything the way I did, but as it seems the issue is related to the language setting in the browser: if I change the default language to "english", all umlauts look good. If I change it to "german" or "german (switzerland)", I see the issue.
tested in chromium, firefox on linux and firefox on mac
adding <spring-framework.version>6.1.3</spring-framework.version> to properties in pom does "fix" the issue
I browsed through the list of issues and noticed https://github.com/spring-projects/spring-framework/issues/32317 which looks suspicious. I try to test the snapshot of 6.1.5 once it is available.
Comment From: scottfrederick
Thanks for the follow-up @resmo. I will close this issue, as it doesn't appear that Spring Boot is the cause.
Comment From: sbrannen
I browsed through the list of issues and noticed spring-projects/spring-framework#32317 which looks suspicious. I try to test the snapshot of 6.1.5 once it is available.
@resmo, please note that 6.1.5-SNAPSHOT builds for Spring Framework are already available.
See https://github.com/spring-projects/spring-framework/issues/32317#issuecomment-1962407804 for details.
Feedback is welcome!
Comment From: resmo
@scottfrederick Thanks for your time. @sbrannen I tested with spring-core-6.1.5-20240225.154205-16.jar but unfortunately it doesn't resolve the issue.
Comment From: wilkinsona
Re-opening to continue the investigation. The problem reminds me a little of https://github.com/spring-projects/spring-boot/issues/32472 and https://github.com/spring-projects/spring-boot/issues/32472#issuecomment-1700885359 in particular. However, unless Tomcat changed its mappings in a maintenance release, I wouldn't expect to see the described change in behavior.
Comment From: resmo
@wilkinsona let me know if I can help, to me it looks related to accept-language header somehow
Comment From: sbrannen
Andy, I think it might be due to the fact that the content type is now cached.
See the analysis from a user in the linked Framework issue which I’ll investigate this afternoon.
Comment From: wilkinsona
Thanks, Sam. To avoid duplicating effort, I'll close this one again for now. Let us know how this afternoon's investigation goes. We can re-open this one again if needed.
Comment From: sbrannen
We've pushed a fix for Spring Framework 6.1.x.
See https://github.com/spring-projects/spring-framework/issues/32317#issuecomment-1964819639 for details.
Comment From: resmo
@sbrannen spring-core-6.1.5-20240226.173247-18.jar fixes the issue, umlauts are shown correctly (content-length size is as it was in 6.1.3)
Thanks!