Add support for CSV file encoding
This commit is contained in:
@@ -29,6 +29,7 @@ in
|
||||
profiles = {
|
||||
my-bank = {
|
||||
parser = "pl.ing";
|
||||
encoding = "utf8";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ export function loadTransactions(file: string, profile: string, server: string,
|
||||
.catch(x => console.error(x))
|
||||
|
||||
fs.createReadStream(file)
|
||||
.pipe(iconv.decodeStream("win1250"))
|
||||
.pipe(iconv.decodeStream(profileConfig.encoding ?? "utf8"))
|
||||
.pipe(Papa.parse(Papa.NODE_STREAM_INPUT))
|
||||
.on('data', handleRow)
|
||||
.on('close', handleClose);
|
||||
|
||||
@@ -8,6 +8,7 @@ export type Config = {
|
||||
|
||||
export type ProfileConfig = {
|
||||
parser: string;
|
||||
encoding?: string;
|
||||
config?: ParserConfig;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user