Skip to main content
PreparationZone Logo
PreparationZone
Back to Fundamentals

Fundamentals · Medium · Free

What is the difference between ASCII and Unicode? Why does encoding matter?

FresherFundamentalsProgramming Fundamentals
Model answer

ASCII vs Unicode

ASCII maps 128 (or 256 extended) characters to byte values—fine for English. Unicode is a universal character set; UTF-8 encodes Unicode code points as variable-length bytes (ASCII-compatible for English).

TermWhat it isInterview note
Code pointNumber for a character (e.g. U+20B9 ₹)Stored in String, not one byte
UTF-8Encoding of Unicode to bytesDefault on web and JVM
MojibakeWrong decoding showsAlways declare UTF-8 in APIs
java
String s = "café"; // JVM strings are UTF-16 internally
byte[] utf8 = s.getBytes(StandardCharsets.UTF_8);
Interview tip: Tie to emoji/Indian languages—why charAt is not always one user-visible character (use code points).