Peter Duniho
11/6/2008 12:02:00 AM
On Wed, 05 Nov 2008 10:15:01 -0800, JDJ <JDJ@discussions.microsoft.com>
wrote:
> We are currently working with C# 2008 (Serial Port Class)
> Read the Serial port data and Write out to the serial port from and to
> our
> control that sends and accepts a string of data
> The data â??Byteâ? sent in the String is value of decimal 0 to 233 (this
> relates to an ACSII hex value of 0-E9) Since the Write (and apparently
> the
> Read) Methods are limited to Decimal 127 (Hex 7F) we get a Char 63 or
> â???â? for
> all characters over 127
>
> We think we need to implement an encoding method - UTF8Encoding but we
> are
> not sure how to do this from the examples that are on the .NET Library
Without seeing an example of the code you're using to write the data, it's
hard to say. But ASCII only supports character codes up to 127. If you
want a different encoding that supports a wider range of character codes,
you do need to make sure you're using that encoding.
Note that UTF-8 may or may not be the encoding you want. In particular,
it handles character codes up to 127 in a single byte, just like ASCII.
But other characters may be longer. If your recipient doesn't support
UTF-8, then encoding as UTF-8 isn't going to improve matters. A common
single-byte encoding that does support characters up to 255 is
ISO-8859-1. But without knowing more about the recipient of the data,
it's impossible to say for sure what encoding would be appropriate.
Pete