java - Text transformed incorrectly after JSoup transform -
i use jsoup parse html. have text string of:
&ap after parsed using:
jsoup.parsebodyfragment("&ap"); it transformed wired character: ≈
the character url:
http://mycompany.com?param=1&app=100 notice &ap part of url replaced wired character hence url becomes:
http://mycompany.com?param=1≈p=100 i think might html encoding.
can let me know how fix this?
could provide more information how reproduce that? tried code:
public static void main(string[] args) throws malformedurlexception, ioexception { document doc = jsoup.parsebodyfragment("<a href=\"http://mycompany.com?param=1&app=100\" />\n<p>http://mycompany.com?param=1&app=100</p>"); system.out.println(doc.tostring()); system.out.println(); system.out.println(doc.getelementsbyattribute("href")); } it prints:
<html> <head></head> <body> <a href="http://mycompany.com?param=1&app=100"></a> <p>http://mycompany.com?param=1&app=100</p> </body> </html> <a href="http://mycompany.com?param=1&app=100"></a> and there & got translated &.
Comments
Post a Comment