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