fix #26; BOM handling
Fix #17; Newline handling
Merge pull request #13 from maxiaojun/master

Fix of Issue 26 on Google Code