File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

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
Jim Yingst

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
I agree. Here's the link:
subject: UTF 8 or Unicode?
It's not a secret anymore!