Converts the specified string so as certain special characters are encoded into named or numeric entities.
Parameters:
s
The string to be encoded.
markupChars
Specifies to encode all characters that may be used in XML markup (defaulttrue
).The following table shows all such characters and the entities into which they are encoded:
Character Entity <
<
&
&
>
>
quoteChars
Specifies encoding of all double quote characters (defaultfalse
):
Character Entity "
"
controlChars
Specifies to encode all control characters (those with the codes < 32) into numeric entities (defaultfalse
).For example,
'\n'
will be encoded as
nonAsciiLetters
Specifies to encode all non-ASCII letters into numeric entities (defaultfalse
).The non-ASCII letters are the characters whose codes >= 128 and for which the Java method
returnsjava.lang.Character.isLetter()
true
.Other non-letter characters with the codes >= 128 are always encoded by this method.
For example, € is encoded as
€
Returns:
The result string with the encoded characters.