Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

File reading blues  RSS feed

 
vijay shanker
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers,

Here i got some thing strange, i don't know why, but when i am reading a file using FileInputStream, it print some special characters that are not in the file.

for example: in the file it is written "Name", But what my program is reading is "��N". and some thing with "ame"; not able to show here; as i paste here.

can any body give me a clue "why"?
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is always nice to TellTheDetails

Can you post the code you are using to read the file.
 
vijay shanker
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nitesh Kant:
It is always nice to TellTheDetails

Can you post the code you are using to read the file.




and the line in the file is
Name Email Note

it prints
��N

and some more character i am not able to copy.
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There can be two problems here:
  • The custom class FileReadByInputStream goofs up the readline() metod. Since you have not given the code of this method, I can not comment on this.
  • It is an encoding problem of the console you are seeing the output on. Precisely the encoding of the program you use to view/edit the text file is not the same as the console on which you are viewing the output.

  •  
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!