The moose likes Beginning Java and the fly likes java is ASCII or Unicode ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java is ASCII or Unicode ??" Watch "java is ASCII or Unicode ??" New topic

java is ASCII or Unicode ??

Adam Lim

Joined: Mar 13, 2007
Posts: 5
hi all,

can i know java is ASCII or Unicode ??

please advise.

thank you
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Java stores strings as UNICODE.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
marc weber

Joined: Aug 31, 2004
Posts: 11343

See JLS - Lexical Structure...
Programs are written in Unicode (�3.1), but lexical translations are provided (�3.2) so that Unicode escapes (�3.3) can be used to include any Unicode character using only ASCII characters.

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
Pat Farrell

Joined: Aug 11, 2007
Posts: 4659

Java is Unicode. But the first set of characters in Unicode are ASCII, specifically US-ASCII. So since ASCII is a subset of Unicode, its trivial to do work in ASCII within Java.

But writing ASCII only code in java is bad form unless its just quick and dirty.
I agree. Here's the link:
subject: java is ASCII or Unicode ??
jQuery in Action, 3rd edition