Possible Duplicate:
How to remove high-ASCII characters from string like ®, ©, ™ in Java
How do I remove rectangle-like unicode characters in Java String
?
Possible Duplicate:
How to remove high-ASCII characters from string like ®, ©, ™ in Java
How do I remove rectangle-like unicode characters in Java String
?
When your characters are rendered as rectangles, than that usually means that your system doesn't have the necessary fonts to display.
Since the installed fonts can vary from machine to machine, it's hard to define what you mean by "rectangle like unicode characters".
If your code is running on the machine that does the display (i.e. you're not just rendering HTML, for example), then you might be able to use Font.canDisplay()
or Font.canDisplayUpTo()
to check if a given char
/String
can be displayed.
How to remove rectangle like unicode characters in java string.
They aren't bad character !. They don't have proper font to be displayed just.
Still if you want you can only accept characters from specified range of your choice . Or its better to provide font
I would start by looking at the Apache Commons Lang StringUtils.escapeHtml()
function code (JavaDoc here: http://commons.apache.org/lang/apidocs/index.html) and see how they do the escaping -- and instead of escaping the char just remove it.