ASCIIEncoding.ASCII.GetBytes() Returning Unexpected Value

Because \u00c0 is not ASCII ( 0-127 range). As result it is encoded as if it is question mark – ? (0x3F).

See MSDN article on ASCIIEncoding:

ASCIIEncoding corresponds to the Windows code page 20127. Because ASCII is a 7-bit encoding, ASCII characters are limited to the lowest 128 Unicode characters, from U+0000 to U+007F. If you use the default encoder returned by the Encoding.ASCII property or the ASCIIEncoding constructor, characters outside that range are replaced with a question mark (?) before the encoding operation is performed.

Leave a Comment