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 932537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:41:06+00:00 2026-05-15T20:41:06+00:00

Background: Windows Server 2003 R2,Wire Service virtual serial port created with RealPort software, Serial

  • 0

Background: Windows Server 2003 R2,Wire Service virtual serial port created with RealPort software,
Serial Port configured as COM5, 9600 baud,8 data bits, no parity bits, 1 stop bit, no flow control,
Using RXTX 2.1-7.

The port COM5 is found, the serial port is created using the portId.open method and port parameters and flow control are set to match the device driver settings above.
I get the serialPort IntupStream and wrap it in an InputStreamReader so I can control the input encoding.
The default encoding is of course Cp1252
I’ve read that if you are using 8 data bits the encoding should be ISO-8859-1 aka Latin1.
and am using the InputStreamReader method:
int c = isr.read();
in a while loop in the case SerialPort.Event.DATA_AVAILABLE
Printing out the integer c and it’s cast to a character ((char)c);
The problem is that the numbers and resulting characters are shifted too high (range is 135 – 250)
The messages all end with “All Rights Reserved.)” and the last characters in each message are the same.
However, the shift is not consistent from character to character.
Have tried other encodings:
UTF8/UTF-8 shift the numbers even higher. as does ascii/us-ascii.
Cp1252 shifts the numbers to the 130 – 350 range except for 3 characters which are shifted to 65533, 8222 and 8240.
Note: using the InputStreamReader.getEncoding() UTF8 and UTF-8 are UTF8 and ascii and us-ascii are ASCII.

Are there other encodings I should try? Anyone else seen this sort of thing?

  • 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-05-15T20:41:07+00:00Added an answer on May 15, 2026 at 8:41 pm

    I’m doing almost the exact same thing. 9600 baud, 8N1 (8 data bits, no parity, 1 stop bit) and we have no issues with character shifting. We don’t even set the encoding, anywhere.

    Our input stream is simply of type InputStream and it’s set with serialPort.getInputStream();

    Try stepping back from InputStreamReader and just using a plain “InputStream.” The encoding should take care of itself.

    Hope that helps in some way,

    –gMale

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

Sidebar

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.