I was given a string like
example.com/test?region=us&lang=en&jurisdiction=us
How can I write the java code to decode the encoded characters like
&
in the string. Is there any existing class/method to decode them?
Thanks.
To include special characters inside XML files you must use the numeric character reference instead of that character. The numeric character reference must be UTF-8 because the supported encoding for XML files is defined in the prolog as encoding="UTF-8" and should not be changed.
When you use wizards to customize any string in your XML file, you can use the following special symbols: <, >, &, ', ". You can also use these symbols when you are editing a query in Expert Mode or when you are manually entering SQL code into XML files between CDATA tags.
Answer. Special characters (such as <, >, &, ", and ' ) can be replaced in XML documents with their html entities using the DocumentKeywordReplace service. However, since html entities used within BPML are converted to the appropriate character, the string mode of DocumentKeywordReplace will not work in this instance.
To unescape HTML/XML entities, use Apache Commons Lang StringEscapeUtils
or homegrow one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With