Skip to content

Commit

Permalink
version bump 0.18.2: hotfix for unicode woes
Browse files Browse the repository at this point in the history
- fixes #2521 h/t @lanchengkai
- fixes #2522 h/t @duchm12
  • Loading branch information
SheetJSDev committed Feb 15, 2022
1 parent 8e6c041 commit fbf43d4
Show file tree
Hide file tree
Showing 25 changed files with 153 additions and 115 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ This log is intended to keep track of backwards-incompatible changes, including
but not limited to API changes and file location changes. Minor behavioral
changes may not be included if they are not expected to break existing code.

## v0.18.2

* Hotfix for unicode processing of XLSX exports

## v0.18.1

* Removed Node ESM build script and folded into standard ESM build
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1485,9 +1485,9 @@ XLSX.writeFileXLSX(workbook, filename, opts);
```

The `writeFile` method embeds a number of different export functions. This is
great for developer experience but not amenable to dead code elimination using
the current toolset. When only XLSX exports are needed, this method avoids
referencing the other export codecs.
great for developer experience but not amenable to tree shaking using the
current developer tools. When only XLSX exports are needed, this method avoids
referencing the other export functions.

The second `opts` argument is optional. ["Writing Options"](#writing-options)
covers the supported properties and behaviors.
Expand Down
2 changes: 1 addition & 1 deletion bits/01_version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
XLSX.version = '0.18.1';
XLSX.version = '0.18.2';
5 changes: 3 additions & 2 deletions bits/05_buf.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function ab2a(data/*:ArrayBuffer|Uint8Array*/)/*:Array<number>*/ {
}

function utf8decode(content/*:string*/) {
var out = [], widx = 0;
var out = [], widx = 0, L = content.length + 250;
var o = new_raw_buf(content.length + 255);
for(var ridx = 0; ridx < content.length; ++ridx) {
var c = content.charCodeAt(ridx);
Expand All @@ -76,10 +76,11 @@ function utf8decode(content/*:string*/) {
o[widx++] = (128|((c>>6)&63));
o[widx++] = (128|(c&63));
}
if(widx > 65530) {
if(widx > L) {
out.push(o.slice(0, widx));
widx = 0;
o = new_raw_buf(65535);
L = 65530;
}
}
out.push(o.slice(0, widx));
Expand Down
1 change: 1 addition & 0 deletions bits/24_hoppers.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ function buf_array()/*:BufArray*/ {
}

function write_record(ba/*:BufArray*/, type/*:string*/, payload, length/*:?number*/) {
if(!XLSBRE) make_XLSBRE();
var t/*:number*/ = +XLSBRE[type], l;
if(isNaN(t)) return; // TODO: throw something here?
if(!length) length = XLSBRecordEnum[t].p || (payload||[]).length || 0;
Expand Down
11 changes: 7 additions & 4 deletions bits/77_parsetab.js
Original file line number Diff line number Diff line change
Expand Up @@ -841,10 +841,13 @@ var XLSBRecordEnum = {
/*::[*/0xFFFF/*::]*/: { n:"" }
};

var XLSBRE = evert_key(XLSBRecordEnum, 'n');
/*jshint -W069 */
XLSBRE["BrtFRTArchID$"] = 0x0010;
/*jshint +W069 */
var XLSBRE;
function make_XLSBRE() {
XLSBRE = evert_key(XLSBRecordEnum, 'n');
/*jshint -W069 */
XLSBRE["BrtFRTArchID$"] = 0x0010;
/*jshint +W069 */
}

/* [MS-XLS] 2.3 Record Enumeration (and other sources) */
var XLSRecordEnum = {
Expand Down
30 changes: 15 additions & 15 deletions dist/xlsx.core.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/xlsx.core.min.map

Large diffs are not rendered by default.

19 changes: 12 additions & 7 deletions dist/xlsx.extendscript.js

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

30 changes: 15 additions & 15 deletions dist/xlsx.full.min.js

Large diffs are not rendered by default.

Binary file added dist/xlsx.full.min.js.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/xlsx.full.min.map

Large diffs are not rendered by default.

19 changes: 12 additions & 7 deletions dist/xlsx.js

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

30 changes: 15 additions & 15 deletions dist/xlsx.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/xlsx.min.map

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions dist/xlsx.mini.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/xlsx.mini.min.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docbits/30_export.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ XLSX.writeFileXLSX(workbook, filename, opts);
```

The `writeFile` method embeds a number of different export functions. This is
great for developer experience but not amenable to dead code elimination using
the current toolset. When only XLSX exports are needed, this method avoids
referencing the other export codecs.
great for developer experience but not amenable to tree shaking using the
current developer tools. When only XLSX exports are needed, this method avoids
referencing the other export functions.

The second `opts` argument is optional. ["Writing Options"](#writing-options)
covers the supported properties and behaviors.
Expand Down
6 changes: 3 additions & 3 deletions misc/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1399,9 +1399,9 @@ XLSX.writeFileXLSX(workbook, filename, opts);
```

The `writeFile` method embeds a number of different export functions. This is
great for developer experience but not amenable to dead code elimination using
the current toolset. When only XLSX exports are needed, this method avoids
referencing the other export codecs.
great for developer experience but not amenable to tree shaking using the
current developer tools. When only XLSX exports are needed, this method avoids
referencing the other export functions.

The second `opts` argument is optional. ["Writing Options"](#writing-options)
covers the supported properties and behaviors.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "xlsx",
"version": "0.18.1",
"version": "0.18.2",
"author": "sheetjs",
"description": "SheetJS Spreadsheet data parser and writer",
"keywords": [
Expand Down
19 changes: 12 additions & 7 deletions xlsx.flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/*global global, exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false */
var XLSX = {};
function make_xlsx_lib(XLSX){
XLSX.version = '0.18.1';
XLSX.version = '0.18.2';
var current_codepage = 1200, current_ansi = 1252;
/*:: declare var cptable:any; */
/*global cptable:true, window */
Expand Down Expand Up @@ -191,7 +191,7 @@ function ab2a(data/*:ArrayBuffer|Uint8Array*/)/*:Array<number>*/ {
}

function utf8decode(content/*:string*/) {
var out = [], widx = 0;
var out = [], widx = 0, L = content.length + 250;
var o = new_raw_buf(content.length + 255);
for(var ridx = 0; ridx < content.length; ++ridx) {
var c = content.charCodeAt(ridx);
Expand All @@ -211,10 +211,11 @@ function utf8decode(content/*:string*/) {
o[widx++] = (128|((c>>6)&63));
o[widx++] = (128|(c&63));
}
if(widx > 65530) {
if(widx > L) {
out.push(o.slice(0, widx));
widx = 0;
o = new_raw_buf(65535);
L = 65530;
}
}
out.push(o.slice(0, widx));
Expand Down Expand Up @@ -4079,6 +4080,7 @@ function buf_array()/*:BufArray*/ {
}

function write_record(ba/*:BufArray*/, type/*:string*/, payload, length/*:?number*/) {
if(!XLSBRE) make_XLSBRE();
var t/*:number*/ = +XLSBRE[type], l;
if(isNaN(t)) return; // TODO: throw something here?
if(!length) length = XLSBRecordEnum[t].p || (payload||[]).length || 0;
Expand Down Expand Up @@ -19888,10 +19890,13 @@ var XLSBRecordEnum = {
/*::[*/0xFFFF/*::]*/: { n:"" }
};

var XLSBRE = evert_key(XLSBRecordEnum, 'n');
/*jshint -W069 */
XLSBRE["BrtFRTArchID$"] = 0x0010;
/*jshint +W069 */
var XLSBRE;
function make_XLSBRE() {
XLSBRE = evert_key(XLSBRecordEnum, 'n');
/*jshint -W069 */
XLSBRE["BrtFRTArchID$"] = 0x0010;
/*jshint +W069 */
}

/* [MS-XLS] 2.3 Record Enumeration (and other sources) */
var XLSRecordEnum = {
Expand Down
19 changes: 12 additions & 7 deletions xlsx.js

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

8 changes: 5 additions & 3 deletions xlsx.mini.flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/*global global, exports, module, require:false, process:false, Buffer:false, ArrayBuffer:false */
var XLSX = {};
function make_xlsx_lib(XLSX){
XLSX.version = '0.18.1';
XLSX.version = '0.18.2';
var current_codepage = 1200, current_ansi = 1252;
/*:: declare var cptable:any; */
/*global cptable:true, window */
Expand Down Expand Up @@ -191,7 +191,7 @@ function ab2a(data/*:ArrayBuffer|Uint8Array*/)/*:Array<number>*/ {
}

function utf8decode(content/*:string*/) {
var out = [], widx = 0;
var out = [], widx = 0, L = content.length + 250;
var o = new_raw_buf(content.length + 255);
for(var ridx = 0; ridx < content.length; ++ridx) {
var c = content.charCodeAt(ridx);
Expand All @@ -211,10 +211,11 @@ function utf8decode(content/*:string*/) {
o[widx++] = (128|((c>>6)&63));
o[widx++] = (128|(c&63));
}
if(widx > 65530) {
if(widx > L) {
out.push(o.slice(0, widx));
widx = 0;
o = new_raw_buf(65535);
L = 65530;
}
}
out.push(o.slice(0, widx));
Expand Down Expand Up @@ -4079,6 +4080,7 @@ function buf_array()/*:BufArray*/ {
}

function write_record(ba/*:BufArray*/, type/*:string*/, payload, length/*:?number*/) {
if(!XLSBRE) make_XLSBRE();
var t/*:number*/ = +XLSBRE[type], l;
if(isNaN(t)) return; // TODO: throw something here?
if(!length) length = XLSBRecordEnum[t].p || (payload||[]).length || 0;
Expand Down

0 comments on commit fbf43d4

Please sign in to comment.