• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unicode Representation

 
sr shashidhar
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi frnds,






My question is how we are getting 8 and 56 for '\u0038'...?


thanks in advance
 
Campbell Ritchie
Sheriff
Pie
Posts: 50189
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I trust you know that 38hex means 56dec?
So your compiler goes through the code, and converts all your Unicode escapes to displayed characters. Your \u0038 becomes 8 and your '\u0038' becomes '8'. That is done before you compile anything. I presume you can work out how 8f becomes 8.0 and how '8' becomes 56, now.
 
Ivan Jozsef Balazs
Rancher
Posts: 981
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(too slow - deleted)

 
Tony Docherty
Bartender
Posts: 2988
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The unicode character \u0038 is '8' so in the first case the value 8 is assigned to the variable. In the second case you are assigning the char with a value of \u0038. This is a Hex value which when converted to decimal is 56.

Edit: Even slower
 
sr shashidhar
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Now i got.
Thanks Campbell Ritchie , Tony Docherty
 
Campbell Ritchie
Sheriff
Pie
Posts: 50189
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You’re welcome
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic