-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
jsoup 1.15.2 appears to insert new spaces #1802
Comments
Thanks for sharing the examples. I'm trying to reproduce this using Jsoup 1.15.2 and Java 17.0.4 since I don't have Kotlin installed on my machine and the following code snippet produces a space between
When I try using the text() method like you do in your example, I don't see an extra space in the final String result.
The above code snippet produces the following String for me without extra spaces when using text() and System.out.println() to print the result to a Ubuntu Linux terminal:
Thanks for sharing your example but maybe I'm missing something when trying to reproduce this issue? |
Hi, |
Thanks so much for your time both, I've edited my post to remove references to using .text() - it didn't line up with the HTML outputs I pasted... I'm not sure what I was smoking there. I've created a tiny scala repro case located here, also attached as two jars in a zip (each one with a different jsoup version) https://github.com/henricook/jsoup-1802-repro jsoup-bug-1802-jsoup-1.15.x.zip I'm Ubuntu / Java 11 |
I know it looks like it, but jsoup is not inserting a space here. It is actually collapsing a newline into a single space - and would collapse multiples of those if present. I have improved the pretty-printer to now also collapse this space, similar to the earlier behavior. Thanks for the report! |
Thanks @jhy ! |
Hi all,
When upgrading from 1.15.1 to 1.15.2 I appear to have encountered unexpected insertion of spaces - is this a bug or desired behaviour?
In this test with a multiline string:
1.15.1 output of
val parsed = Jsoup.parse(textWithHtml)
:1.15.2 output of
val parsed = Jsoup.parse(textWithHtml)
:(space inserted between
</p>
and<span>
)EDITED: To remove references to using .text() on the output of Jsoup.parse
The text was updated successfully, but these errors were encountered: