Skip to content

Commit

Permalink
Load CSVs as latin1
Browse files Browse the repository at this point in the history
  • Loading branch information
jlaasonen committed Mar 11, 2019
1 parent fdda111 commit 98261ec
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/extractFromDir.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const mapNames = require('./mapNames')
const Reference = require('./Reference')

function extractFromFile (fileName) {
const contents = fs.readFileSync(fileName)
const encoding = 'latin1'
const contents = fs.readFileSync(fileName, { encoding })
return extractDocuments(contents)
}

Expand Down
2 changes: 1 addition & 1 deletion lib/extractFromDir.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ test('Counts hits from all the files in the folder', () => {
})

test('Loads correct files', () => {
expect(fs.readFileSync.mock.calls).toEqual(_.keys(files).map(file => [`${directory}/${file}`]))
expect(fs.readFileSync.mock.calls).toEqual(_.keys(files).map(file => [`${directory}/${file}`, { encoding: 'latin1' }]))
})

0 comments on commit 98261ec

Please sign in to comment.