public static java.lang.String unicodeEscapeInvalidChars(java.lang.String s,
This method converts the characters of a String which are not
valid in a particular codeset into unicode escape sequences.
Normally, when converting a String to a byte array of
natively encoded characters, any characters which are not valid
in the native codeset will be replaced with a question mark (?).
You can use this method to convert such characters to
unicode escape sequences before doing the conversion, thus preserving
the character information.
JDK methods used here may not be supported on all platforms, so we
will fall back to unicodeEscapeNonASCIIChars. We also fall back to
unicodeEscapeNonASCIIChars if encoding is NULL or invalid.