Permalink
Browse files

Strip BOM to handle a file encoded as ucs2.

  • Loading branch information...
heycalmdown committed Feb 7, 2012
1 parent dc81f24 commit 2574d891689d0fe05b81b7984ec5fff86d9bff13
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 2574d89

Please sign in to comment.