Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spring boot 3.2.3: umlaut encoding issue? #99

Closed
resmo opened this issue Feb 23, 2024 · 8 comments
Closed

spring boot 3.2.3: umlaut encoding issue? #99

resmo opened this issue Feb 23, 2024 · 8 comments

Comments

@resmo
Copy link

resmo commented Feb 23, 2024

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".

Screenshot from 2024-02-23 17-49-30

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
@resmo
Copy link
Author

resmo commented Feb 24, 2024

reproducer https://github.com/resmo/spring-boot-3.2.3-demo-htmx-umlauts

The issue only shows up in 3.2.3 with this htmx-spring-boot.

@resmo
Copy link
Author

resmo commented Feb 24, 2024

seems the issue does no show if the browser content language is set to "english". I tested with german or german (switzerland)

@resmo
Copy link
Author

resmo commented Feb 26, 2024

it seems related to spring framework 6.1.4 (not spring boot). But the thing is, I only see it using htmx-spring-boot, not "normal" thymeleaf responses and mentioned before, if accept language header is de (!= en).

Do you have a clue?

@xhaggi
Copy link
Contributor

xhaggi commented Feb 26, 2024

Could you please provide the request and response headers for both the direct request and the htmx request!

@resmo
Copy link
Author

resmo commented Feb 26, 2024

Could you please provide the request and response headers for both the direct request and the htmx request!

HTMX

spring framework 6.1.3 (works as expected)

request

GET /umlauts2 HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
Accept: */*
Accept-Language: de-CH,de;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate, br
HX-Request: true
HX-Current-URL: http://localhost:8080/
DNT: 1
Connection: keep-alive
Referer: http://localhost:8080/
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
Pragma: no-cache
Cache-Control: no-cache

response

HTTP/1.1 200 
Content-Type: text/html;charset=UTF-8
Content-Language: de-CH
Content-Length: 51
Date: Mon, 26 Feb 2024 16:31:44 GMT
Keep-Alive: timeout=60
Connection: keep-alive

spring framework 6.1.4 (broken)

GET /umlauts2 HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
Accept: */*
Accept-Language: de-CH,de;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate, br
HX-Request: true
HX-Current-URL: http://localhost:8080/
DNT: 1
Connection: keep-alive
Referer: http://localhost:8080/
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
Pragma: no-cache
Cache-Control: no-cache

response

HTTP/1.1 200 
Content-Type: text/html;charset=UTF-8
Content-Language: de-CH
Content-Length: 48
Date: Mon, 26 Feb 2024 16:34:06 GMT
Keep-Alive: timeout=60
Connection: keep-alive

Not-HTMX

spring framewor 6.1.3 (works)

request

GET / HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: de-CH,de;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate, br
DNT: 1
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: cross-site
Pragma: no-cache
Cache-Control: no-cache

response

HTTP/1.1 200 
Content-Type: text/html;charset=UTF-8
Content-Language: de-CH
Transfer-Encoding: chunked
Date: Mon, 26 Feb 2024 16:41:43 GMT
Keep-Alive: timeout=60
Connection: keep-alive

spring framewor 6.1.4 (broken)

request

GET / HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: de-CH,de;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate, br
DNT: 1
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: cross-site
Pragma: no-cache
Cache-Control: no-cache

response

HTTP/1.1 200 
Content-Type: text/html;charset=UTF-8
Content-Language: de-CH
Transfer-Encoding: chunked
Date: Mon, 26 Feb 2024 16:34:06 GMT
Keep-Alive: timeout=60
Connection: keep-alive

@resmo
Copy link
Author

resmo commented Feb 26, 2024

there is currently a analysis of a regression going on in spring-projects/spring-framework#32317 which might be related

@sbrannen
Copy link

We've pushed a fix for Spring Framework 6.1.x.

See spring-projects/spring-framework#32317 (comment) for details.

@resmo
Copy link
Author

resmo commented Feb 26, 2024

closing, the fix pushed Spring Framework 6.1.x. worked for me!

@resmo resmo closed this as completed Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants