@f-o-t/ofx 2.3.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +7 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -537,10 +537,10 @@ var CHARSET_MAP = {
537
537
  "1252": "windows-1252",
538
538
  "WINDOWS-1252": "windows-1252",
539
539
  CP1252: "windows-1252",
540
- "8859-1": "iso-8859-1",
541
- "ISO-8859-1": "iso-8859-1",
542
- LATIN1: "iso-8859-1",
543
- "LATIN-1": "iso-8859-1",
540
+ "8859-1": "windows-1252",
541
+ "ISO-8859-1": "windows-1252",
542
+ LATIN1: "windows-1252",
543
+ "LATIN-1": "windows-1252",
544
544
  "UTF-8": "utf-8",
545
545
  UTF8: "utf-8",
546
546
  NONE: "utf-8",
@@ -794,7 +794,7 @@ function hasUtf8MultiByte(buffer) {
794
794
  }
795
795
  function parseHeaderFromBuffer(buffer) {
796
796
  const maxHeaderSize = Math.min(buffer.length, 1000);
797
- const headerSection = new TextDecoder("iso-8859-1").decode(buffer.slice(0, maxHeaderSize));
797
+ const headerSection = new TextDecoder("windows-1252").decode(buffer.slice(0, maxHeaderSize));
798
798
  const header = {};
799
799
  const singleLineMatch = headerSection.match(/^(OFXHEADER:\d+.*?)(?=<OFX|<\?xml)/is);
800
800
  if (singleLineMatch?.[1]) {
@@ -1063,7 +1063,7 @@ async function* parseStream(input, options) {
1063
1063
  combined.set(chunk, offset);
1064
1064
  offset += chunk.length;
1065
1065
  }
1066
- const headerSection = new TextDecoder("iso-8859-1").decode(combined.slice(0, Math.min(combined.length, 1000)));
1066
+ const headerSection = new TextDecoder("windows-1252").decode(combined.slice(0, Math.min(combined.length, 1000)));
1067
1067
  if (headerSection.includes("<OFX") || headerSection.includes("<?xml")) {
1068
1068
  const charsetMatch = headerSection.match(/CHARSET:(\S+)/i);
1069
1069
  if (charsetMatch && !detectedEncoding) {
@@ -1136,7 +1136,7 @@ async function* parseBatchStream(files, options) {
1136
1136
  yield { type: "file_start", fileIndex: i, filename: file.filename };
1137
1137
  try {
1138
1138
  let fileTransactionCount = 0;
1139
- const headerSection = new TextDecoder("iso-8859-1").decode(file.buffer.slice(0, Math.min(file.buffer.length, 1000)));
1139
+ const headerSection = new TextDecoder("windows-1252").decode(file.buffer.slice(0, Math.min(file.buffer.length, 1000)));
1140
1140
  const charsetMatch = headerSection.match(/CHARSET:(\S+)/i);
1141
1141
  const encoding = charsetMatch ? getEncodingFromCharset(charsetMatch[1]) : options?.encoding ?? "utf-8";
1142
1142
  const decoder = new TextDecoder(encoding);
package/package.json CHANGED
@@ -59,5 +59,5 @@
59
59
  },
60
60
  "type": "module",
61
61
  "types": "./dist/index.d.ts",
62
- "version": "2.3.0"
62
+ "version": "2.3.1"
63
63
  }