Can anybody please tell me what is the range of Unicode printable characters? [e.g. Ascii printable character range is \u0020 - \u007f]
See, http://en.wikipedia.org/wiki/Unicode_control_characters
You might want to look especially at C0 and C1 control character http://en.wikipedia.org/wiki/C0_and_C1_control_codes
The wiki says, the C0 control character is in the range U+0000—U+001F and U+007F (which is the same range as ASCII) and C1 control character is in the range U+0080—U+009F
other than C-control character, Unicode also has hundreds of formatting control characters, e.g. zero-width non-joiner, which makes character spacing closer, or bidirectional text control. This formatting control characters are rather scattered.
More importantly, what are you doing that requires you to know Unicode's non-printable characters? More likely than not, whatever you're trying to do is the wrong approach to solve your problem.
I want to create a random unicode string generator which will generate printable characters.
Printable by whom? Do you want to include eg. all the Chinese characters? Many users won't have fonts for them, so ‘printing’ them would give you nothing, a blank box, or some other useless replacement character.
One good reason is to avoid security exploits: bugzilla.mozilla.org/show_bug.cgi?id=968576
@bobince My browser can display Chinese characters. Not sure if that was the case in 2010 though.
"What are you doing that requires you to know Unicode's non-printable characters?" User pastes a number from Windows calculator into a text box (e.g.
165063688192
). But in reality the string will be:U+202D
165063688192
U+202C
. Thus the string will be unparsable, and nobody will be able to figure out why. So thanks to a feature nobody wanted: we now need to write theTrimStrimToPrintable(String s)
function.