How to allow character '&' without convert to '&'
See original GitHub issuei have data from http post data like this :
"billingCode=820131114000031&custName=Josh & Mark&numAccount=25800¶meterId=2&traceId=820131114000031"
if i use jsoup :
String postDataori = Jsoup.clean("billingCode=820131114000031&custName=Josh & Mark&numAccount=25800¶meterId=2&traceId=820131114000031", Whitelist.basic());
System.out.println("PostData : " + postDataori);
and the output like this :
PostData : billingCode=820131114000031&custName=Josh & Mark&numAccount=25800&parameterId=2&traceId=820131114000031
my question is how to allow character ‘&’ without convert to & ?
Issue Analytics
- State:
- Created 10 years ago
- Comments:20 (5 by maintainers)
Top Results From Across the Web
Java String Replace '&' with & but not & to &amp
I want to replace all the occurrences of & character to & While replacing this, I also need to make sure that I...
Read more >Generating XML without converting '&' to 'amp;' - Ask TOM
Hi Tom, do you know of anyway of utilising the XDK to generate XML without certain characters being displayed as HTML entities.
Read more >PHP htmlspecialchars_decode() Function - W3Schools
Definition and Usage. The htmlspecialchars_decode() function converts some predefined HTML entities to characters. HTML entities that will be decoded are:.
Read more >MATLAB convertCharsToStrings - MathWorks
Convert character arrays to string arrays, leaving other arrays unaltered ... you can use convertCharsToStrings to make your code accept character arrays.
Read more >Conversion Functions | Alteryx Help
Conversion functions can be used with String and Number data types. ... that cannot be used to represent a character may give a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@cketti My issue is not with Parsing; It’s with rendering of the HTML when calling Document’s toString() or html().
As I wrote above, I need to render links that work, so the delimiter of the Query String is a single
&symbol, and not an HTML entity, e.g. https://www.google.com/search?source=hp&q=jsoupBut JSoup always produces the delimiter as HTML entities, which leads to broken links, e.g. https://www.google.com/search?source=hp&q=jsoup
There has to be a way to render the HTML with single
&. This issue has affected many others judging by the mailing list and StackOverflow, and they resorted to doing something like:The best solution IMO is to add another
EscapeModethat will be more permissive, and will not enforce entities where they are not needed nor desired.Hahaha. True. I fully acknowledge that. Which is why I was hoping Jsoup would have an option to allow valid ampersands to remain unencoded. But if that’s not gonna happen, at least my hacky code is getting the job done 👍