0

I was using Scala and try to store some String Integer as straight Integer. However some String Integer has a format of this ÿþ in front of the number.

How do I clean this up? Why does this happen?


Rephrased question:

How do I check all characters like ÿþand delete them so I can safely convert Strings to Integer? I don't know if this appears only on the first line or not. The file has 16,000 lines and although I only see it at the first line so far, I can't be sure.

windweller
  • 2,375
  • 4
  • 30
  • 55
  • "I don't know if this appears only on the first line or not. The file has 16,000 lines and although I only see it at the first line so far, I can't be sure." - It's only 16000 lines. Check! Just load it into notepad... – The Archetypal Paul Mar 31 '14 at 19:58
  • @Paul OK..it turns out to be an encoding problem. – windweller Mar 31 '14 at 23:26

1 Answers1

4

These two are the Byte order mark of UTF-16.

You could use the tools from Apache Commons IO.

Community
  • 1
  • 1