Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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
 
jQuery in Action, 2nd edition
 
subject: UTF 8 or Unicode?
 
Similar Threads
Character Set for Arabic and English
File Encoding
problem inserting arabic data
displaying unicode in JSP
Character Encoding