This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Java in General and the fly likes UTF 8 or Unicode? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "UTF 8 or Unicode?" Watch "UTF 8 or Unicode?" New topic
Author

UTF 8 or Unicode?

Dan Temple
Ranch Hand

Joined: Jul 10, 2001
Posts: 93
I have read from one source that Java uses UTF 8 to internally represent variables and such. But another source claims that it uses Unicode. What is the real story?
Thanks in advance
Dan
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
It uses both in different places. For class files it uses UTF-8 representations, as per the JVM spec, and in runtime memory it generally uses straight Unicode (which is not really specified anywhere, it's just easiest, given that you need to be able to return a Unicode value for the charAt() method.)


"I'm not back." - Bill Harding, Twister
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: UTF 8 or Unicode?