Puspender Tanwar wrote:When i studied for it, I came to know that java uses UTF-16 for java source code encoding. But I am unable to relate this to my issue.
If anyone can also provide some good resource for such knowledge, that would b great for me.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
JLS wrote:
Octal escapes are provided for compatibility with C, but can express only Unicode values \u0000 through \u00FF, so Unicode escapes are usually preferred.
377, surely? It should be in the Java® Language Specification (=JLS).Dave Tolls wrote:. . . escape character followed by an integer up to (I think) 255.
Campbell Ritchie wrote:
377, surely? It should be in the Java® Language Specification (=JLS).Dave Tolls wrote:. . . escape character followed by an integer up to (I think) 255.
Where are you printing? The Windows® command line is notorious for being unable to render characters > 0x00ff, and even some “extended ASCII” characters come out oddly. For example £ is 0x00a3 but renders as ú on the command line. It has to do with the encoding used, which isn't Unicode but something beginning cp. If you haven't found anything really good to read about encodings, try Joel Spolsky.Puspender Tanwar wrote:. . . . But what I noticed is that I can only be able to print upto \u00FF only. Beyond that for every unicode value, output is '?' . . . .
That's where encodings come in.
The earliest idea for Unicode encoding, which led to the myth about the two bytes, was, hey, let's just store those numbers in two bytes each. So Hello becomes
00 48 00 65 00 6C 00 6C 00 6F
Right? Not so fast! Couldn't it also be:
48 00 65 00 6C 00 6C 00 6F 00 ?
Well, technically, yes, I do believe it could, and, in fact, early implementors wanted to be able to store their Unicode code points in high-endian or low-endian mode, whichever their particular CPU was fastest at, and lo, it was evening and it was morning and there were already two ways to store Unicode
Puspender Tanwar wrote:How 00 48 can be same as 48 00 as stated above? As per my knowledge these two are different Hex-numbers.
That new kid is a freak. Show him this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|