Difference between ASCIIEncoding and UnicodeEncoding in C#
and
Difference between ASCIIEncoding and Encoding in C#
Please lead me to a right way
Thnx
Difference between ASCIIEncoding and UnicodeEncoding in C#
and
Difference between ASCIIEncoding and Encoding in C#
Please lead me to a right way
Thnx
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
AlanRank #669 · 3.6K reputationPosted Aug 12, 2008, 4:55 AM EDT
Encoding (in the System.Text namespace) is an abstract class which is the parent of various specific encoding classes, including ASCIIEncoding and UnicodeEncoding.
ASCIIEncoding is a single byte encoding. Only the first 7 bits are used so the possible range is characters with ASCII values of between 0 to 127.
Unicode uses two bytes to encode each character and is the native type used in .NET for the Char and String types. This gives it a range of 0 to 65,535. There's also something called 'surrogate pairs' which extends the range still further. However, they are unimportant and so I won't bore you with them just now :)