Skip to content

Commit

Permalink
Merge pull request koles#12 from heycalmdown/patch-1
Browse files Browse the repository at this point in the history
Strip BOM to handle a file encoded as ucs2.
  • Loading branch information
koles committed Feb 26, 2012
2 parents e21d6f4 + 2574d89 commit 9cd26e4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/ya-csv.js
Expand Up @@ -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) {
Expand Down

0 comments on commit 9cd26e4

Please sign in to comment.