Sunday, 15 July 2012

java - Why I can't use the org.apache.commons.lang.StringEscapeUtils to convert this String containing character as &apos and &egrave? -


I try to use something with class org.apache.commons.lang.StringEscapeUtils But I am getting some problems.

I have the following status in my code:

  string not normalized = "c & amp; apos; & amp; egrave;"; System.out.println ("Not Normalized:" + Not Normal); System.out.println ("generalized:" + StringEscapeUtils.escapeJava (nonmodified));  

So I have declared the not normalized field (at least in my head) not to represent the normalized string in which apostrophe < / & apos; and More Expressions; The vowel pronounced (which should be e character)

Then I try to print it without generalization And I think that c & apos; & Egrave; string prints and its normalized version and I CE normalized converted string.

But the problem is that I still get the same output, in fact, I get the output as a console:

  is not normal Made: c & amp; Apos; & Amp;; Generalized: C & amp; Apo; Agavev;  

Why? What am I missing? what is wrong? How can I execute this test and in the string & amp; Apos ?

What you want to do is

then

  System.out.println ("generalized:" + StringEscapeUtils.unescapeHTML (nonormaired));  

who prints

  generalized: c & amp; Apos; È  

Unfortunately, and therefore can not be reasonably unavoidable with this tool you can see the & amp; Apos but the & amp; Not for Agraw . You have to mix and match.


No comments:

Post a Comment