I\'m using a framwork which returns malformed Strings with \"empty\" characters from time to time.
\"foobar\" for example is represented by: [,f,o,o,b,a,r]
T
Thank you Johannes Rössel. It actually was '\uFEFF'
The following code works:
final StringBuilder sb = new StringBuilder();
for (final char character : body.toCharArray()) {
if (character != '\uFEFF') {
sb.append(character);
}
}
final String sanitzedString = sb.toString();
Anyone know of a way to just include a range of valid characters instead of excluding 95% of the UTF8 range?