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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
AlanPosted Aug 12, 2008, 8:55 AM
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 :)