Skip to content

Commit

Permalink
Fix encoding of output file
Browse files Browse the repository at this point in the history
  • Loading branch information
szapp committed Sep 15, 2024
1 parent a37dd51 commit 2805fe0
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions __tests__/writer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ name=string:key2.WAV
[]
`

expect(mockWriteFileSync).toHaveBeenCalledWith(outFile, expectedFormatString)
expect(mockWriteFileSync).toHaveBeenCalledWith(outFile, expectedFormatString, 'latin1')
})

it('writes an empty list correctly', () => {
Expand All @@ -85,6 +85,6 @@ END
[]
`

expect(mockWriteFileSync).toHaveBeenCalledWith(outFile, expectedFormatString)
expect(mockWriteFileSync).toHaveBeenCalledWith(outFile, expectedFormatString, 'latin1')
})
})
6 changes: 3 additions & 3 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class Parser {

console.log(`Reading ${relPath}`)
const srcRootPath = posix.dirname(fullPath)
const input = fs.readFileSync(fullPath, 'utf-8')
const input = fs.readFileSync(fullPath, 'latin1')
const lines = input.split(/\r?\n/).filter((line) => line.trim() !== '')

// Iterate over the lines in the file
Expand Down Expand Up @@ -118,7 +118,7 @@ export class Parser {

console.log(`Parsing ${relPath}`)

const input = fs.readFileSync(fullPath, 'utf-8')
const input = fs.readFileSync(fullPath, 'latin1')
this.parseStr(input)
}

Expand Down
2 changes: 1 addition & 1 deletion src/writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ name=string:${key}.WAV
formatString += '[]\n'

// Write to disk
fs.writeFileSync(outFile, formatString)
fs.writeFileSync(outFile, formatString, 'latin1')
}

0 comments on commit 2805fe0

Please sign in to comment.