Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7998479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:13:10+00:00 2026-06-04T15:13:10+00:00

I have a need to send bytes through the serial port and wanted to

  • 0

I have a need to send bytes through the serial port and wanted to do this using the convenience of the C# class SerialPort. However it apperas there is a severe restriction on sending raw bytes through the serial port using this class as, quoting from the ASCIIEncoding class docs:

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.

This is NOT what I want. If I have a byte value greated than 0x7F I want it sent as that value, NOT encoding as a question mark. I cannot use UTF-8 encoding as this can introduce more bytes for characters which my receiving device does not expect. Both SerialPort.Write Method (Char[], Int32, Int32) and (stupidly in my opinion) SerialPort.Write Method (Byte[], Int32, Int32) encode the data prior to transmission.

It appears that I can create my own EncoderFallback class but from my understanding this only allows me to specify another character to use instead of ‘?’ or am I incorrect in assuming this?

So is it at all possible to send bytes that have NOT been interferred with via the SerialPort class?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T15:13:12+00:00Added an answer on June 4, 2026 at 3:13 pm

    There’s a comment on the byte[] overload page:

    The remarks about ASCIIEncoding and the other types of encoding do not apply to this overload. This overload uses byte arrays, bypassing the encoding.

    (It looks like these encoding remarks were copy/pasted from the other overloads of Write. Those overloads – using character arrays and strings – do use the encoding).

    — Micah Copple (possibly user mjcopple – should be able to ‘forward’ reputation!)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list that I need to send through a URL to a
I have this need to place my app in the share/send context menu so
I need to send my phone contacts in android as bytes. So i have
Good day, i have a requirement where i need to send files(image/videos.. etc) through
What I need to do is send multiple files using DataStreams. I'm doing this
I have a situation where i need to send commands to a running java
I have a slow connection that I need to send a PNG image over
i have a scenario where in i need to send an xml as a
I need to send a request to a quote server. Each request should have
I have defined a custom struct which I need to send over to another

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.