• Post Reply Bookmark Topic Watch Topic
  • New Topic

First character of a File Becomes "?" on reading  RSS feed

 
echarish Kumar
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am reading a file which is stroed in UTF-8 Format and m reading it by code below.
if (is != null) {
InputStreamReader sr = new InputStreamReader(is, "UTF-8");
BufferedReader br = new BufferedReader(sr);
String str = "";
while ((str = br.readLine()) != null) {
writer.append(str + "\r\n");
}}

---- The output is
?
$C_FamilyName $C_FirstName?
$C_ProspectNo


When i am reading this file and printing it to console the first line gets printed as ? but the first line of the file is empty.
Please provide solution on how to resolve this issue.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Was the file saved with the BOM ?
 
echarish Kumar
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure, if its stored with BOM.. is their a way that i can check that... and also how will it affect the file...
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That "?" tells me that it's there Using an binary editor, you can check it. As a workaround, check this.
 
echarish Kumar
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Christophe Thanks for your help... the issue i am able to resolve.. thanks a lot..
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!