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&amp;app=100"></a>    <p>http://mycompany.com?param=1&amp;app=100</p>  </body> </html>  <a href="http://mycompany.com?param=1&amp;app=100"></a> 

and there & got translated &amp.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -