This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Java in General and the fly likes Problem in serial port reading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Problem in serial port reading" Watch "Problem in serial port reading" New topic

Problem in serial port reading

priya pratheepp
Ranch Hand

Joined: Apr 02, 2008
Posts: 59
Hi dears,

I am doing one program which read serial port data (for bar code reader) using java application.

My program is working well and reading serial data but it is not displaying special characters.When i read through hyperterminal i can see all special characters but when see data throught the output of java program these special characters are missing...

I don't know i am doing something wrong in stream or ???

My code is

Please help

Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
The String constructor you are using expects the bytes to be in the platforms default encoding. If the application on the other end uses a different encoding, you need to specify it by using the constructor that allows the specify the encoding to use.

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
I agree. Here's the link:
subject: Problem in serial port reading
It's not a secret anymore!