Hello, Geraldo. :)

I once had to achieve something similar, so I created a new CharSequenceTranslator aggregating my own lookup table and the original arrays of entities. I had something along these lines:

-------------------------------
private static final CharSequenceTranslator HTML4_EURO
            = new AggregateTranslator(
                    new LookupTranslator(new String[][]{
                        {"€", "€"}
                    }),
                    new LookupTranslator(
                            EntityArrays.BASIC_ESCAPE()
                    ),
                    new LookupTranslator(
                            EntityArrays.ISO8859_1_ESCAPE()
                    ),
                    new LookupTranslator(
                            EntityArrays.HTML40_EXTENDED_ESCAPE()
                    )
            );

...

// later on

String str = HTML4_EURO.translate("áéíóú €");

// should print áéíóú €
System.out.println(str);
-------------------------------

Hope it helps. :)

All the best,

Paulo

On 25-06-2015 15:21, Geraldo Netto wrote:
Dear All,

Sorry for cross-posting between user/dev lists
I'm trying to escape special chars using StringEscapeUtils

And i would like to ask
how can i change the escape format from html string code to html number code

So:
StringEscapeUtils.escapeHtml4(EURO_SIGN) is returning €

But i would like to return: €

Do you have any suggestions on how to handle this?
In any case i'm willing to volunteer myself to write the code as long
as a mentor shows up :)


Thank You Very Much and Kind Regards,

Geraldo Netto
Sapere Aude => Non dvcor, dvco
São Paulo, Brasil, -3gmt
site: http://exdev.sf.net/

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to