Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference Between ASCIIEncoding and Encoding

I understand that Encoding can be used to initialize object to perform any type of Encoding, ASCII, Unicode, UTF-8 etc. It appears to me that all these are sufficient for performing any kind of encoding, then what is the need for ASCIIEncoding?

like image 702
Shamim Hafiz - MSFT Avatar asked Apr 12 '11 13:04

Shamim Hafiz - MSFT


People also ask

What is the difference between UTF-8 and UTF-16 encoding?

1. UTF-8 uses one byte at the minimum in encoding the characters while UTF-16 uses minimum two bytes. In UTF-8, every code point from 0-127 is stored in a single bytes. Only code points 128 and above are stored using 2,3 or in fact, up to 4 bytes.

What is difference between ASCII and UTF-8?

UTF-8 encodes Unicode characters into a sequence of 8-bit bytes. The standard has a capacity for over a million distinct codepoints and is a superset of all characters in widespread use today. By comparison, ASCII (American Standard Code for Information Interchange) includes 128 character codes.

Is it more efficient to use ASCII or UTF-8 as an encoding?

There is absolutely no difference in this case; UTF-8 is identical to ASCII in this character range. If storage is an important consideration, maybe look into compression. A simple Huffman compression will use something like 3 bits per byte for this kind of data.

Is ASCII a character set or encoding?

ASCII (American Standard Code for Information Interchange) is the most common character encoding format for text data in computers and on the internet. In standard ASCII-encoded data, there are unique values for 128 alphabetic, numeric or special additional characters and control codes.


1 Answers

The Encoding class, in addition to being the base class of all encoders, provides static property accessors to the named subclasses.

Encoding.ASCII returns an instance of ASCIIEncoding which, in turn, subclasses Encoding and passes the codepage 0x4e9f (US-ASCII) to the base constructor.

like image 50
Richard Szalay Avatar answered Sep 22 '22 12:09

Richard Szalay