Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unicode Character

 
abalfazl hossein
Ranch Hand
Posts: 635
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://www.fileformat.info/info/unicode/char/633/index.htm

C/C++/Java source code "\u0633"
HTML Entity (decimal) س
Python source code u"\u0633"

It is only one character, But in each case has its own code.I want to know how this character in java has this code: "\u0633" and what does this code mean?
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
abalfazl hossein wrote:http://www.fileformat.info/info/unicode/char/633/index.htm

C/C++/Java source code "\u0633"
HTML Entity (decimal) س
Python source code u"\u0633"

It is only one character, But in each case has its own code.

All the above code points to unique Unicode 0633, except HTML as its converted to decimal value.
abalfazl hossein wrote:I want to know how this character in java has this code: "\u0633" and what does this code mean?

In Java, when you passed something like this "\uXXXX", the Java interpreter treat it as Unicode and try to convert it into the specific character which eventually rendered by the graphical window you are using.
More info on JLS: http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15284
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to know what code maps to what character, then look at the Unicode website: Unicode Charts.
 
Campbell Ritchie
Sheriff
Pie
Posts: 48968
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
abalfazl hossein wrote: . . . C/C++/Java source code "\u0633" . . .
In Java™, "\u0633" does not mean the character س; it means a String containing the single character س.
 
abalfazl hossein
Ranch Hand
Posts: 635
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
n Java™, "\u0633" does not mean the character س; it means a String containing the single character س.


But in the link it matches only by س

Do you mean that one sentence match to "\u0633"?
 
Rob Spoor
Sheriff
Pie
Posts: 20531
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"\u0633" is a String with only one character. That character is '\u0633'. Note the difference in double and single quotes.
 
abalfazl hossein
Ranch Hand
Posts: 635
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JAVA uses UTF-16 to save characters. in UTF-16 س is 0633, But as I see there is u0633...

does it mean java has its own encoding?

How the س convert to u0633 in java?
 
Campbell Ritchie
Sheriff
Pie
Posts: 48968
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
abalfazl hossein wrote:. . . does it mean java has its own encoding? . . .
No
 
Campbell Ritchie
Sheriff
Pie
Posts: 48968
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
abalfazl hossein wrote: . . . How the س convert to u0633 in java?
Not at all. When you push the س key on your keyboard, it doesn't sent a س, but the binary equivalent of 0x0633 (0000_0110_0011_0011). Java™ records that as the number 0x633 in binary. It is the screen and graphics and Unicode records associated with Java™ which take 0x0633 and display س.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic