{"action":"opened","issue":{"url":"https://api.github.com/repos/benjamn/recast/issues/148","labels_url":"https://api.github.com/repos/benjamn/recast/issues/148/labels{/name}","comments_url":"https://api.github.com/repos/benjamn/recast/issues/148/comments","events_url":"https://api.github.com/repos/benjamn/recast/issues/148/events","html_url":"https://github.com/benjamn/recast/issues/148","id":56511185,"number":148,"title":"unexpected whitespace character when unicode 65279 (utf-8 bom) encountered","user":{"login":"ichernev","id":757060,"avatar_url":"https://avatars.githubusercontent.com/u/757060?v=3","gravatar_id":"","url":"https://api.github.com/users/ichernev","html_url":"https://github.com/ichernev","followers_url":"https://api.github.com/users/ichernev/followers","following_url":"https://api.github.com/users/ichernev/following{/other_user}","gists_url":"https://api.github.com/users/ichernev/gists{/gist_id}","starred_url":"https://api.github.com/users/ichernev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ichernev/subscriptions","organizations_url":"https://api.github.com/users/ichernev/orgs","repos_url":"https://api.github.com/users/ichernev/repos","events_url":"https://api.github.com/users/ichernev/events{/privacy}","received_events_url":"https://api.github.com/users/ichernev/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-02-04T10:49:27Z","updated_at":"2015-02-04T10:49:27Z","closed_at":null,"body":"If recast.parse encounters character code 65279, recast throws an exception\r\n\r\n```javascript\r\nAssertionError: \"unexpected whitespace character\" undefined \"\"\r\n    at countSpaces (/home/iskren/src/moment/node_modules/recast/lib/lines.js:108:20)\r\n    at /home/iskren/src/moment/node_modules/recast/lib/lines.js:140:21\r\n    at Array.map (native)\r\n    at fromString (/home/iskren/src/moment/node_modules/recast/lib/lines.js:136:46)\r\n    at Object.parse (/home/iskren/src/moment/node_modules/recast/lib/parser.js:16:17)\r\n```\r\n\r\nThis can be achieved by reading a file with utf-8 bom and converting to string:\r\n```javascript\r\n> x = fs.readFileSync(\"file_with_utf8_bom.js\", {encoding: \"utf8\"})  // 0x EF BB BF first bytes\r\n> x.charCodeAt(0)\r\n65279\r\n```\r\n\r\nSample file with utf-8 bom: https://raw.githubusercontent.com/moment/moment/2.9.0/test/locale/he.js\r\n\r\nNot sure if this is a fs.readFileSync issue, or recast issue."}}