dotnet-api-docs
dotnet-api-docs copied to clipboard
SerialPort.Write with byte[] buffer does not encode characters
Summary
By default, SerialPort uses ASCIIEncoding to encode the characters. ASCIIEncoding encodes all characters greater than 127 as (char)63 or '?'. To support additional characters in that range, set Encoding to UTF8Encoding, UTF32Encoding, or UnicodeEncoding.
This statement in the remarks section of the prototype Write (byte[] buffer, int offset, int count);
is false and should be removed.
The byte[] buffer will not be encoded!
There has been some confusion: https://stackoverflow.com/questions/32864198/can-i-use-serialport-write-to-send-byte-array