Reputation: 143
When i am trying to scan a html tag through antisammy, It gives weird output. It converts single quotes to double quotes.
CleanResults cr = as.scan(dirtyContent, policy);
System.out.println(cr.getCleanHTML());
Input string - <span style="font-family: 'times new roman', times, serif;">My name is Gourav</span>
Output string - <span style="font-family: "times new roman" , times , serif;">My name is Gourav</span>
So, as you can see, the single quotes are encoded as "
which when decoded gives "
instead of '
. This is causing problems for me.
Antisammy Version - 1.5.3
Policy File - antisamy-anythinggoes.xml
How can i solve this? Any help is appreciated
Upvotes: 0
Views: 446
Reputation: 143
I raised this issue in the Antisammy GitHub project. This issue is now fixed :) . Please check the release notes for Release 1.7.1.
Upvotes: 0
Reputation: 823
try this simple solution
try
{
.
.
.
dirtyContent.replaceAll("'", "SOME_COMBINATION_OF_CHARS");
CleanResults cr = as.scan(dirtyContent, policy);
dirtyContent.replaceAll("SOME_COMBINATION_OF_CHARS", "'");// here is your sanitised data
}
catch(Exception ex)
{
//do something on expn
}
Upvotes: 1