aspose file tools*
The moose likes Beginning Java and the fly likes Unicode Character Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Unicode Character" Watch "Unicode Character" New topic
Author

Unicode Character

abalfazl hossein
Ranch Hand

Joined: Sep 06, 2007
Posts: 635
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

Joined: Feb 19, 2008
Posts: 2902
    
    1

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


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14144
    
  18

If you want to know what code maps to what character, then look at the Unicode website: Unicode Charts.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38765
    
  23
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

Joined: Sep 06, 2007
Posts: 635
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

Joined: Oct 27, 2005
Posts: 19693
    
  20

"\u0633" is a String with only one character. That character is '\u0633'. Note the difference in double and single quotes.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
abalfazl hossein
Ranch Hand

Joined: Sep 06, 2007
Posts: 635
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

Joined: Oct 13, 2005
Posts: 38765
    
  23
abalfazl hossein wrote:. . . does it mean java has its own encoding? . . .
No
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38765
    
  23
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 س.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unicode Character