• Post Reply Bookmark Topic Watch Topic
  • New Topic

Code Points and Code Units  RSS feed

 
Sagar Dabas
Ranch Hand
Posts: 47
C++ Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to learn these but got confused.

This program gave 62 errors when compiled with command prompt, all of them were illegal expression. I saved the file in UNICODE format.
But when I compiled it using NetBeans there were no errors and the output was 5 , 5 instead of 5 , 6.

The symbol ♭ is represented by two code units or code points?
Whats the difference between code oints and code units?
What is surrogate area?

Please explain.... Thanks..

 
Pierre Sugar
Ranch Hand
Posts: 62
Java Ruby Ubuntu
 
Campbell Ritchie
Marshal
Posts: 56530
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The program ran first time on my terminal and printed 5 , 5.
To find out the ♭ symbol, you would have to go to the Unicode Index and look up “flat”; if it is ≤ 0xffff then it is one code point.
 
Sagar Dabas
Ranch Hand
Posts: 47
C++ Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we store supplementary characters in char type......Please explain

I don't know how to type supplementary characters , so I can not check it myself.

Thanks.....
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sagar Dabas wrote:Can we store supplementary characters in char type

No, but Java Strings can handle supplementary characters as a "surrogate pair". I suggest you look at the documentation for java.lang.Character, and particularly the isHighSurrogate() and isSurrogatePair() methods. This page also contains a glossary of useful terms.

Winston
 
Sagar Dabas
Ranch Hand
Posts: 47
C++ Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all... you guys are really helpful..
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!