• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Strange behaviour of SequenceInputStream with UTF-16 Encoding

 
cohen schingis
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to create a SequenceStream of UTF-16 encoded files.




if i run this i got this as output:



if i run it, with only one File it works fine:



output:



Where are the Questionsmarks from? how can i handle this?
 
Paul Clapham
Sheriff
Posts: 21113
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch, cohen!

It looks to me like the last line in each of the files doesn't have a line-ending character, so when you concatenate the three files, the last line of File 1 and the first line of File 2 look like one line of text. That would at least explain why they are combined that way.

As for the question mark, it looks to me like each of the file has some bytes at the end which (as we already saw) aren't line-endings, but instead are some other character which can't be represented as text.

I would suggest you look at the files to see what's actually happening. A hex editor might be better than an ordinary text editor to do that, since the text editor might hide the file trailer character from you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic