Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Strip BOM to handle a file encoded as ucs2. #12

Merged
merged 1 commit into from

2 participants

@heycalmdown

Current version of ya-csv has a problem while dealing with ucs encoded file, even set encoding option.
Please review this patch.

Thanks

@koles koles merged commit 9cd26e4 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 7, 2012
  1. @heycalmdown
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/ya-csv.js
View
5 lib/ya-csv.js
@@ -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) {
Something went wrong with that request. Please try again.