I\'m having a problem with a program that communicates over a serial port. One of the characters it must send and receive is the degree symbol, ASCII 0xBF. It\'s been working fi
The degree symbol in both 1252 and 28591 appears to be xB0, not xBF.
System.Text.ASCIIEncoding isn't the right encoding to use for 8-bit communication. Instead use e.g. the "ISO 8859-1 Latin 1; Western European (ISO)" code page:
port.Encoding = Encoding.GetEncoding(28591);
Your problem is that ASCIIEncoding is a 7 bit encoding. You're looking for something that supports Extended ASCII.
The following will get you Codepage 1252.
System.Text.Encoding.GetEncoding(1252);
This will get you ISO 8859-1.
System.Text.Encoding.GetEncoding(28591);
Both of these are considered Extended ASCII and both contain symbols (mostly with the same byte representation) typically associated with this set, such as © , ¥ , and º . See the referenced links for more information about which characters are included in each encoding.