Permalink
Browse files

Merge pull request #12 from heycalmdown/patch-1

Strip BOM to handle a file encoded as ucs2.
  • Loading branch information...
2 parents e21d6f4 + 2574d89 commit 9cd26e4e4e9b3c6d1e441291843bd59f6f79e68a @koles committed Feb 26, 2012
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/ya-csv.js
View
@@ -27,6 +27,11 @@ sys.inherits(CsvReader, events.EventEmitter);
CsvReader.prototype.parse = function(data) {
var ps = this.parsingStatus;
+ if (ps.openRecord.length == 0) {
+ if (data.charCodeAt(0) === 0xFEFF) {
+ data = data.slice(1);
+ }
+ }
for (var i = 0; i < data.length; i++) {
var c = data.charAt(i);
switch (c) {

0 comments on commit 9cd26e4

Please sign in to comment.